[Scummvm-git-logs] scummvm master -> c475cd819aaf9fa92f6381da4d42a06c655b9823
whiterandrek
whiterandrek at gmail.com
Sun May 17 04:11:15 UTC 2020
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
e07d8bb153 PETKA: implemented SetSeq and EndSeq opcodes
c475cd819a PETKA: removed global variable
Commit: e07d8bb1537f7b923d83fadfaff4ef234a51f04d
https://github.com/scummvm/scummvm/commit/e07d8bb1537f7b923d83fadfaff4ef234a51f04d
Author: Andrei Prykhodko (whiterandrek at gmail.com)
Date: 2020-05-17T07:09:44+03:00
Commit Message:
PETKA: implemented SetSeq and EndSeq opcodes
Changed paths:
A engines/petka/interfaces/sequence.cpp
A engines/petka/interfaces/sequence.h
engines/petka/module.mk
engines/petka/objects/object_bg.cpp
engines/petka/q_system.cpp
engines/petka/q_system.h
diff --git a/engines/petka/interfaces/sequence.cpp b/engines/petka/interfaces/sequence.cpp
new file mode 100644
index 0000000000..1f5f10496c
--- /dev/null
+++ b/engines/petka/interfaces/sequence.cpp
@@ -0,0 +1,129 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "common/system.h"
+
+#include "petka/q_system.h"
+#include "petka/q_manager.h"
+#include "petka/sound.h"
+#include "petka/petka.h"
+#include "petka/video.h"
+#include "petka/objects/object.h"
+#include "petka/interfaces/main.h"
+#include "petka/interfaces/sequence.h"
+
+namespace Petka {
+
+InterfaceSequence::InterfaceSequence() {
+ _fxId = 0;
+ _musicId = 0;
+}
+
+void InterfaceSequence::start(int id) {
+ removeTexts();
+ for (uint i = 0; i < _objs.size(); ++i) {
+ if (_objs[i]->_resourceId != -666) {
+ g_vm->resMgr()->removeResource(_objs[i]->_resourceId);
+ }
+ QMessageObject *obj = (QObject *)_objs[i];
+ g_vm->soundMgr()->removeSound(g_vm->resMgr()->findSoundName(_objs[i]->_resourceId));
+ obj->_sound = nullptr;
+ }
+
+ g_system->getMixer()->pauseAll(true);
+
+ QObjectBG* bg = (QObjectBG *)g_vm->getQSystem()->findObject(id);
+ _objs.push_back(bg);
+
+ if (bg->_musicId == _musicId) {
+ Sound *s = g_vm->soundMgr()->findSound(g_vm->resMgr()->findSoundName(bg->_musicId));
+ if (s) {
+ s->pause(false);
+ }
+ } else {
+ g_vm->soundMgr()->removeSound(g_vm->resMgr()->findSoundName(bg->_musicId));
+ Sound *sound = g_vm->soundMgr()->addSound(g_vm->resMgr()->findSoundName(bg->_musicId), Audio::Mixer::kMusicSoundType);
+ if (sound) {
+ sound->play(true);
+ }
+ _musicId = bg->_musicId;
+ }
+
+ if (bg->_fxId == _fxId) {
+ Sound *s = g_vm->soundMgr()->findSound(g_vm->resMgr()->findSoundName(bg->_fxId));
+ if (s) {
+ s->pause(false);
+ }
+ } else {
+ g_vm->soundMgr()->removeSound(g_vm->resMgr()->findSoundName(bg->_fxId));
+ Sound *sound = g_vm->soundMgr()->addSound(g_vm->resMgr()->findSoundName(bg->_fxId), Audio::Mixer::kMusicSoundType);
+ if (sound) {
+ sound->play(true);
+ }
+ _fxId = bg->_fxId;
+ }
+
+ const BGInfo *info = g_vm->getQSystem()->_mainInterface->findBGInfo(id);
+ if (info) {
+ for (uint i = 0; i < info->attachedObjIds.size(); ++i) {
+ QMessageObject *obj = g_vm->getQSystem()->findObject(info->attachedObjIds[i]);
+ g_vm->resMgr()->loadFlic(obj->_resourceId);
+ obj->_sound = g_vm->soundMgr()->addSound(g_vm->resMgr()->findSoundName(obj->_resourceId),
+ Audio::Mixer::kSFXSoundType);
+ obj->_hasSound = obj->_sound != nullptr;
+ obj->_startSound = false;
+ _objs.push_back(obj);
+ }
+ }
+
+ g_vm->getQSystem()->_currInterface = this;
+ g_vm->videoSystem()->makeAllDirty();
+}
+
+void InterfaceSequence::stop() {
+ removeTexts();
+ for (uint i = 0; i < _objs.size(); ++i) {
+ if (_objs[i]->_resourceId != -666) {
+ g_vm->resMgr()->removeResource(_objs[i]->_resourceId);
+ }
+ QMessageObject *obj = (QObject *)_objs[i];
+ g_vm->soundMgr()->removeSound(g_vm->resMgr()->findSoundName(_objs[i]->_resourceId));
+ obj->_sound = nullptr;
+ }
+
+ g_vm->soundMgr()->removeSound(g_vm->resMgr()->findSoundName(_fxId));
+ g_vm->soundMgr()->removeSound(g_vm->resMgr()->findSoundName(_musicId));
+
+ _fxId = 0;
+ _musicId = 0;
+
+ g_system->getMixer()->pauseAll(false);
+
+ g_vm->getQSystem()->_currInterface = g_vm->getQSystem()->_mainInterface.get();
+}
+
+void InterfaceSequence::onLeftButtonDown(const Common::Point p) {
+ QVisibleObject *obj = findObject(-2);
+ obj->onClick(p.x, p.y);
+}
+
+} // End of namespace Petka
diff --git a/engines/petka/interfaces/sequence.h b/engines/petka/interfaces/sequence.h
new file mode 100644
index 0000000000..41ba2b5226
--- /dev/null
+++ b/engines/petka/interfaces/sequence.h
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PETKA_SEQUENCE_H
+#define PETKA_SEQUENCE_H
+
+#include "petka/interfaces/interface.h"
+
+namespace Petka {
+
+class InterfaceSequence : public Interface {
+public:
+ InterfaceSequence();
+
+ void start(int id);
+ void stop() override;
+
+ void onLeftButtonDown(const Common::Point p) override;
+
+private:
+ int _fxId;
+ int _musicId;
+};
+
+} // End of namespace Petka
+
+#endif
diff --git a/engines/petka/module.mk b/engines/petka/module.mk
index 19f4f78f6f..74e64e1a58 100644
--- a/engines/petka/module.mk
+++ b/engines/petka/module.mk
@@ -17,6 +17,7 @@ MODULE_OBJS = \
interfaces/map.o \
interfaces/panel.o \
interfaces/save_load.o \
+ interfaces/sequence.o \
interfaces/startup.o \
objects/object.o \
objects/object_bg.o \
diff --git a/engines/petka/objects/object_bg.cpp b/engines/petka/objects/object_bg.cpp
index d81151938f..739a7cc078 100644
--- a/engines/petka/objects/object_bg.cpp
+++ b/engines/petka/objects/object_bg.cpp
@@ -34,6 +34,7 @@
#include "petka/q_system.h"
#include "petka/q_manager.h"
#include "petka/interfaces/main.h"
+#include "petka/interfaces/sequence.h"
#include "petka/objects/object_bg.h"
#include "petka/objects/heroes.h"
@@ -70,8 +71,10 @@ void QObjectBG::processMessage(const QMessage &msg) {
break;
}
case kSetSeq:
+ g_vm->getQSystem()->_sequenceInterface->start(_id);
break;
case kEndSeq:
+ g_vm->getQSystem()->_sequenceInterface->stop();
break;
}
diff --git a/engines/petka/q_system.cpp b/engines/petka/q_system.cpp
index 52ad028b72..4a9e917d42 100644
--- a/engines/petka/q_system.cpp
+++ b/engines/petka/q_system.cpp
@@ -30,6 +30,7 @@
#include "petka/interfaces/startup.h"
#include "petka/interfaces/main.h"
#include "petka/interfaces/save_load.h"
+#include "petka/interfaces/sequence.h"
#include "petka/interfaces/panel.h"
#include "petka/interfaces/map.h"
#include "petka/objects/object_cursor.h"
@@ -167,6 +168,7 @@ bool QSystem::init() {
_mainInterface.reset(new InterfaceMain());
_startupInterface.reset(new InterfaceStartup());
_saveLoadInterface.reset(new InterfaceSaveLoad());
+ _sequenceInterface.reset(new InterfaceSequence());
_panelInterface.reset(new InterfacePanel());
_mapInterface.reset(new InterfaceMap());
if (g_vm->getPart() == 0) {
diff --git a/engines/petka/q_system.h b/engines/petka/q_system.h
index 1ad1b47e39..2b57084b71 100644
--- a/engines/petka/q_system.h
+++ b/engines/petka/q_system.h
@@ -40,6 +40,7 @@ class QObjectStar;
class QObjectPetka;
class QObjectChapayev;
class InterfaceSaveLoad;
+class InterfaceSequence;
class InterfaceMain;
class InterfaceStartup;
class InterfacePanel;
@@ -89,6 +90,7 @@ public:
Common::ScopedPtr<QObjectStar> _star;
Common::ScopedPtr<InterfaceMain> _mainInterface;
Common::ScopedPtr<InterfaceSaveLoad> _saveLoadInterface;
+ Common::ScopedPtr<InterfaceSequence> _sequenceInterface;
Common::ScopedPtr<InterfaceStartup> _startupInterface;
Common::ScopedPtr<InterfacePanel> _panelInterface;
Common::ScopedPtr<InterfaceMap> _mapInterface;
Commit: c475cd819aaf9fa92f6381da4d42a06c655b9823
https://github.com/scummvm/scummvm/commit/c475cd819aaf9fa92f6381da4d42a06c655b9823
Author: Andrei Prykhodko (whiterandrek at gmail.com)
Date: 2020-05-17T07:09:59+03:00
Commit Message:
PETKA: removed global variable
Changed paths:
engines/petka/interfaces/main.cpp
diff --git a/engines/petka/interfaces/main.cpp b/engines/petka/interfaces/main.cpp
index 2b9e7b5a64..cc8594816a 100644
--- a/engines/petka/interfaces/main.cpp
+++ b/engines/petka/interfaces/main.cpp
@@ -41,8 +41,6 @@
namespace Petka {
-Sound *g_trackedSound = nullptr;
-
InterfaceMain::InterfaceMain() {
Common::ScopedPtr<Common::SeekableReadStream> stream(g_vm->openFile("backgrnd.bg", true));
if (!stream)
More information about the Scummvm-git-logs
mailing list