mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-24 21:21:05 +00:00
PETKA: stop interfaces properly
This commit is contained in:
parent
c6bb053a09
commit
6ce60dbed7
@ -33,6 +33,11 @@ namespace Petka {
|
||||
Interface::Interface()
|
||||
: _objUnderCursor(nullptr), _startIndex(0) {}
|
||||
|
||||
void Interface::stop() {
|
||||
setText(Common::U32String(""), 0, 0);
|
||||
g_vm->videoSystem()->makeAllDirty();
|
||||
}
|
||||
|
||||
void Interface::setText(const Common::U32String &text, uint16 textColor, uint16 outlineColor) {
|
||||
removeTexts();
|
||||
if (!text.empty())
|
||||
|
@ -38,7 +38,7 @@ public:
|
||||
virtual ~Interface() {}
|
||||
|
||||
virtual void start(int id) {};
|
||||
virtual void stop() {};
|
||||
virtual void stop();
|
||||
|
||||
virtual void onLeftButtonDown(const Common::Point p) {};
|
||||
virtual void onRightButtonDown(const Common::Point p) {};
|
||||
|
@ -37,23 +37,24 @@ namespace Petka {
|
||||
const char *const mapName = "\xCA\xC0\xD0\xD2\xC0"; // КАРТА
|
||||
|
||||
void InterfaceMap::start(int id) {
|
||||
if (!g_vm->getQSystem()->_room->_showMap)
|
||||
QSystem *sys = g_vm->getQSystem();
|
||||
if (!sys->_room->_showMap)
|
||||
return;
|
||||
|
||||
_objs.clear();
|
||||
|
||||
QObjectBG *bg = (QObjectBG *)g_vm->getQSystem()->findObject(mapName);
|
||||
QObjectBG *bg = (QObjectBG *)sys->findObject(mapName);
|
||||
_roomResID = bg->_resourceId;
|
||||
_objs.push_back(bg);
|
||||
|
||||
const Common::Array<BGInfo> &infos = g_vm->getQSystem()->_mainInterface->_bgs;
|
||||
const Common::Array<BGInfo> &infos = sys->_mainInterface->_bgs;
|
||||
|
||||
for (uint i = 0; i < infos.size(); ++i) {
|
||||
if (infos[i].objId != bg->_id) {
|
||||
continue;
|
||||
}
|
||||
for (uint j = 0; j < infos[i].attachedObjIds.size(); ++j) {
|
||||
QMessageObject *obj = g_vm->getQSystem()->findObject(infos[i].attachedObjIds[j]);
|
||||
QMessageObject *obj = sys->findObject(infos[i].attachedObjIds[j]);
|
||||
FlicDecoder *flc = g_vm->resMgr()->loadFlic(obj->_resourceId);
|
||||
flc->setFrame(1);
|
||||
obj->_z = 1;
|
||||
@ -68,7 +69,7 @@ void InterfaceMap::start(int id) {
|
||||
break;
|
||||
}
|
||||
|
||||
QObjectCursor *cursor = g_vm->getQSystem()->_cursor.get();
|
||||
QObjectCursor *cursor = sys->_cursor.get();
|
||||
_savedCursorId = cursor->_resourceId;
|
||||
_savedCursorActionType = cursor->_actionType;
|
||||
|
||||
@ -85,16 +86,24 @@ void InterfaceMap::start(int id) {
|
||||
}
|
||||
|
||||
void InterfaceMap::stop() {
|
||||
QSystem *sys = g_vm->getQSystem();
|
||||
QObjectCursor *cursor = sys->_cursor.get();
|
||||
|
||||
if (_objUnderCursor)
|
||||
((QMessageObject *)_objUnderCursor)->_isShown = false;
|
||||
|
||||
setText(Common::U32String(""), 0, 0);
|
||||
|
||||
QObjectCursor *cursor = g_vm->getQSystem()->_cursor.get();
|
||||
sys->_xOffset = _savedXOffset;
|
||||
sys->_sceneWidth = _savedSceneWidth;
|
||||
|
||||
cursor->_resourceId = _savedCursorId;
|
||||
cursor->_actionType = _savedCursorActionType;
|
||||
|
||||
g_vm->getQSystem()->_currInterface = g_vm->getQSystem()->_prevInterface;
|
||||
g_vm->getQSystem()->_currInterface->onMouseMove(Common::Point(cursor->_x, cursor->_y));
|
||||
sys->_currInterface = g_vm->getQSystem()->_prevInterface;
|
||||
sys->_currInterface->onMouseMove(Common::Point(cursor->_x, cursor->_y));
|
||||
|
||||
Interface::stop();
|
||||
}
|
||||
|
||||
void InterfaceMap::onLeftButtonDown(const Common::Point p) {
|
||||
|
@ -20,9 +20,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef PETKA_STARTUP_H
|
||||
#define PETKA_STARTUP_H
|
||||
|
||||
#include "common/config-manager.h"
|
||||
#include "common/system.h"
|
||||
|
||||
@ -96,17 +93,18 @@ InterfacePanel::InterfacePanel() {
|
||||
void InterfacePanel::start(int id) {
|
||||
readSettings();
|
||||
|
||||
QSystem *sys = g_vm->getQSystem();
|
||||
QObjectBG *bg = (QObjectBG *)g_vm->getQSystem()->findObject(kPanelObjName);
|
||||
_objs.push_back(bg);
|
||||
g_vm->getQSystem()->update();
|
||||
const Common::Array<BGInfo> &infos = g_vm->getQSystem()->_mainInterface->_bgs;
|
||||
sys->update();
|
||||
const Common::Array<BGInfo> &infos = sys->_mainInterface->_bgs;
|
||||
|
||||
for (uint i = 0; i < infos.size(); ++i) {
|
||||
if (infos[i].objId != bg->_id) {
|
||||
continue;
|
||||
}
|
||||
for (uint j = 0; j < infos[i].attachedObjIds.size(); ++j) {
|
||||
QMessageObject *obj = g_vm->getQSystem()->findObject(infos[i].attachedObjIds[j]);
|
||||
QMessageObject *obj = sys->findObject(infos[i].attachedObjIds[j]);
|
||||
FlicDecoder *flc = g_vm->resMgr()->loadFlic(obj->_resourceId);
|
||||
flc->setFrame(1);
|
||||
obj->_z = 1;
|
||||
@ -122,15 +120,40 @@ void InterfacePanel::start(int id) {
|
||||
break;
|
||||
}
|
||||
|
||||
QObjectCursor *cursor = g_vm->getQSystem()->_cursor.get();
|
||||
_savedCursorType = cursor->_actionType;
|
||||
|
||||
initCursor(4901, 1, 1);
|
||||
|
||||
_savedSceneWidth = sys->_sceneWidth;
|
||||
_savedXOffset = sys->_xOffset;
|
||||
|
||||
sys->_sceneWidth = 640;
|
||||
sys->_xOffset = 0;
|
||||
|
||||
updateSliders();
|
||||
updateSubtitles();
|
||||
|
||||
g_vm->getQSystem()->_currInterface = this;
|
||||
sys->_currInterface = this;
|
||||
g_vm->videoSystem()->makeAllDirty();
|
||||
}
|
||||
|
||||
void InterfacePanel::stop() {
|
||||
QSystem *sys = g_vm->getQSystem();
|
||||
QObjectCursor *cursor = sys->_cursor.get();
|
||||
|
||||
sys->_xOffset = _savedXOffset;
|
||||
sys->_sceneWidth = _savedSceneWidth;
|
||||
|
||||
cursor->_resourceId = _savedCursorRes;
|
||||
cursor->_actionType = _savedCursorType;
|
||||
|
||||
sys->_currInterface = sys->_prevInterface;
|
||||
sys->_currInterface->onMouseMove(Common::Point(cursor->_x, cursor->_y));
|
||||
|
||||
Interface::stop();
|
||||
}
|
||||
|
||||
void InterfacePanel::onLeftButtonDown(const Common::Point p) {
|
||||
int i = 0;
|
||||
for (i = _objs.size() - 1; i > 0; --i) {
|
||||
@ -301,5 +324,3 @@ void InterfacePanel::applySettings() {
|
||||
}
|
||||
|
||||
} // End of namespace Petka
|
||||
|
||||
#endif
|
||||
|
@ -32,6 +32,7 @@ public:
|
||||
InterfacePanel();
|
||||
|
||||
void start(int id) override;
|
||||
void stop() override;
|
||||
|
||||
void onLeftButtonDown(const Common::Point p) override;
|
||||
void onMouseMove(const Common::Point p) override;
|
||||
@ -46,6 +47,9 @@ private:
|
||||
public:
|
||||
int _savedXOffset;
|
||||
int _savedSceneWidth;
|
||||
int _savedCursorType;
|
||||
int _savedCursorRes;
|
||||
|
||||
int _subtitles;
|
||||
int _speechFrame;
|
||||
int _musicFrame;
|
||||
|
@ -47,29 +47,44 @@ InterfaceSaveLoad::InterfaceSaveLoad() {
|
||||
}
|
||||
|
||||
void InterfaceSaveLoad::startSaveLoad(bool saveMode) {
|
||||
QSystem *sys = g_vm->getQSystem();
|
||||
QObjectCursor *cursor = sys->_cursor.get();
|
||||
|
||||
_loadMode = !saveMode;
|
||||
QObjectBG *bg = (QObjectBG *)g_vm->getQSystem()->findObject("SAVELOAD");
|
||||
|
||||
QObjectBG *bg = (QObjectBG *)sys->findObject("SAVELOAD");
|
||||
_objs.push_back(bg);
|
||||
bg->_resourceId = kFirstSaveLoadPageId + _page + (_loadMode ? 0 : 5);
|
||||
|
||||
QObjectCursor *cursor = g_vm->getQSystem()->_cursor.get();
|
||||
_objs.push_back(cursor);
|
||||
_savedCursorId = cursor->_resourceId;
|
||||
cursor->_resourceId = 4901;
|
||||
cursor->_isShown = 1;
|
||||
cursor->_animate = 0;
|
||||
cursor->setCursorPos(cursor->_x, cursor->_y, 0);
|
||||
_savedSceneWidth = sys->_sceneWidth;
|
||||
_savedXOffset = sys->_xOffset;
|
||||
|
||||
g_vm->getQSystem()->_currInterface = this;
|
||||
sys->_sceneWidth = 640;
|
||||
sys->_xOffset = 0;
|
||||
|
||||
_savedCursorId = cursor->_resourceId;
|
||||
_savedCursorType = cursor->_actionType;
|
||||
|
||||
initCursor(4901, 1, 0);
|
||||
|
||||
sys->_currInterface = this;
|
||||
g_vm->videoSystem()->makeAllDirty();
|
||||
}
|
||||
|
||||
void InterfaceSaveLoad::stop() {
|
||||
QSystem *sys = g_vm->getQSystem();
|
||||
QObjectCursor *cursor = g_vm->getQSystem()->_cursor.get();
|
||||
|
||||
sys->_xOffset = _savedXOffset;
|
||||
sys->_sceneWidth = _savedSceneWidth;
|
||||
|
||||
cursor->_resourceId = _savedCursorId;
|
||||
g_vm->getQSystem()->_currInterface = g_vm->getQSystem()->_prevInterface;
|
||||
g_vm->getQSystem()->_currInterface->onMouseMove(Common::Point(cursor->_x, cursor->_y));
|
||||
g_vm->videoSystem()->makeAllDirty();
|
||||
cursor->_actionType = _savedCursorType;
|
||||
|
||||
sys->_currInterface = sys->_prevInterface;
|
||||
sys->_currInterface->onMouseMove(Common::Point(cursor->_x, cursor->_y));
|
||||
|
||||
Interface::stop();
|
||||
}
|
||||
|
||||
void InterfaceSaveLoad::onLeftButtonDown(const Common::Point p) {
|
||||
|
@ -44,7 +44,11 @@ private:
|
||||
private:
|
||||
bool _loadMode;
|
||||
uint _page;
|
||||
|
||||
int _savedXOffset;
|
||||
int _savedSceneWidth;
|
||||
int _savedCursorId;
|
||||
int _savedCursorType;
|
||||
|
||||
Common::Rect _saveRects[6];
|
||||
Common::Rect _nextPageRect;
|
||||
|
@ -119,6 +119,7 @@ void InterfaceSequence::stop() {
|
||||
g_system->getMixer()->pauseAll(false);
|
||||
|
||||
g_vm->getQSystem()->_currInterface = g_vm->getQSystem()->_mainInterface.get();
|
||||
Interface::stop();
|
||||
}
|
||||
|
||||
void InterfaceSequence::onLeftButtonDown(const Common::Point p) {
|
||||
|
@ -132,4 +132,11 @@ void InterfaceStartup::onMouseMove(const Common::Point p) {
|
||||
cursor->setCursorPos(p.x, p.y, 0);
|
||||
}
|
||||
|
||||
void InterfaceStartup::stop() {
|
||||
QObjectBG *bg = (QObjectBG *)g_vm->getQSystem()->findObject(kStartupObjName);
|
||||
Common::String sound = g_vm->resMgr()->findSoundName(bg->_musicId);
|
||||
g_vm->soundMgr()->removeSound(sound);
|
||||
Interface::stop();
|
||||
}
|
||||
|
||||
} // End of namespace Petka
|
||||
|
@ -30,6 +30,7 @@ namespace Petka {
|
||||
class InterfaceStartup : public Interface {
|
||||
public:
|
||||
void start(int id) override;
|
||||
void stop() override;
|
||||
|
||||
void onLeftButtonDown(const Common::Point p) override;
|
||||
void onMouseMove(const Common::Point p) override;
|
||||
|
@ -45,7 +45,8 @@ namespace Petka {
|
||||
|
||||
QSystem::QSystem()
|
||||
: _cursor(nullptr), _case(nullptr), _star(nullptr), _petka(nullptr), _chapayev(nullptr),
|
||||
_mainInterface(nullptr), _currInterface(nullptr), _prevInterface(nullptr), _isIniting(0) {}
|
||||
_mainInterface(nullptr), _currInterface(nullptr), _prevInterface(nullptr), _isIniting(0),
|
||||
_sceneWidth(640) {}
|
||||
|
||||
QSystem::~QSystem() {
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user