PETKA: moved processing kTotalInit to QSystem

This commit is contained in:
Andrei Prykhodko 2020-05-30 21:03:54 +03:00
parent 10698f89b8
commit 4b1a659e71
6 changed files with 13 additions and 13 deletions

View File

@ -66,9 +66,6 @@ InterfaceMain::InterfaceMain() {
}
void InterfaceMain::start(int id) {
g_vm->getQSystem()->update();
g_vm->getQSystem()->_isIniting = 0;
_objs.push_back(g_vm->getQSystem()->getPetka());
_objs.push_back(g_vm->getQSystem()->getChapay());

View File

@ -50,9 +50,6 @@ enum {
};
void InterfaceStartup::start(int id) {
g_vm->getQSystem()->update();
g_vm->getQSystem()->_isIniting = 0;
QObjectBG *bg = (QObjectBG *)g_vm->getQSystem()->findObject(kStartupObjName);
_objs.push_back(bg);

View File

@ -76,7 +76,7 @@ void QObjectPetka::processMessage(const QMessage &arg) {
QMessageObject::processMessage(msg);
if (msg.opcode == kSet || msg.opcode == kPlay) {
initSurface();
if (!g_vm->getQSystem()->_isIniting) {
if (!g_vm->getQSystem()->_totalInit) {
setPos(_x_, _y_);
}
}

View File

@ -319,7 +319,7 @@ void QMessageObject::processReaction(QReaction *r, const QMessage *msg) {
}
void QMessageObject::play(int id, int type) {
if (g_vm->getQSystem()->_isIniting) {
if (g_vm->getQSystem()->_totalInit) {
_resourceId = id;
} else {
if (!_notLoopedSound || g_vm->isDemo()) {

View File

@ -45,7 +45,7 @@ namespace Petka {
QSystem::QSystem()
: _mainInterface(nullptr), _currInterface(nullptr), _prevInterface(nullptr),
_isIniting(0), _sceneWidth(640) {}
_totalInit(false), _sceneWidth(640) {}
QSystem::~QSystem() {
for (uint i = 0; i < _allObjects.size(); ++i) {
@ -57,7 +57,6 @@ bool QSystem::init() {
Common::ScopedPtr<Common::SeekableReadStream> stream(g_vm->openFile("script.dat", true));
if (!stream)
return false;
_isIniting = 1;
Common::ScopedPtr<Common::SeekableReadStream> namesStream(g_vm->openFile("Names.ini", true));
Common::ScopedPtr<Common::SeekableReadStream> castStream(g_vm->openFile("Cast.ini", true));
Common::ScopedPtr<Common::SeekableReadStream> bgsStream(g_vm->openFile("BGs.ini", true));
@ -96,8 +95,6 @@ bool QSystem::init() {
_allObjects.push_back(obj);
}
addMessageForAllObjects(kTotalInit);
_allObjects.push_back(new QObjectCursor);
_allObjects.push_back(new QObjectCase);
_allObjects.push_back(new QObjectStar);
@ -108,11 +105,20 @@ bool QSystem::init() {
_sequenceInterface.reset(new InterfaceSequence());
_panelInterface.reset(new InterfacePanel());
_mapInterface.reset(new InterfaceMap());
if (g_vm->getPart() == 0) {
_prevInterface = _currInterface = _startupInterface.get();
} else {
_prevInterface = _currInterface = _mainInterface.get();
}
_totalInit = true;
addMessageForAllObjects(kTotalInit);
update();
_totalInit = false;
_currInterface->start(0);
return true;
}

View File

@ -94,7 +94,7 @@ public:
Interface *_currInterface;
Interface *_prevInterface;
int _isIniting;
bool _totalInit;
int _fxId;
int _musicId;