[Scummvm-git-logs] scummvm master -> 1f4ed583d27a038096fea6d94ebe97cdf60c6203
whiterandrek
whiterandrek at gmail.com
Fri May 29 22:45:35 UTC 2020
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
dedc6be7b9 PETKA: refactored attaching objects to interfaces
0a0c103f8a PETKA: simplified room loading
1f4ed583d2 PETKA: fix compilation
Commit: dedc6be7b9f6b25e76e6b7a654532c1349ead257
https://github.com/scummvm/scummvm/commit/dedc6be7b9f6b25e76e6b7a654532c1349ead257
Author: Andrei Prykhodko (whiterandrek at gmail.com)
Date: 2020-05-30T01:42:02+03:00
Commit Message:
PETKA: refactored attaching objects to interfaces
Changed paths:
engines/petka/interfaces/map.cpp
engines/petka/interfaces/panel.cpp
engines/petka/interfaces/startup.cpp
diff --git a/engines/petka/interfaces/map.cpp b/engines/petka/interfaces/map.cpp
index 6f53f1ba01..cfa08983f2 100644
--- a/engines/petka/interfaces/map.cpp
+++ b/engines/petka/interfaces/map.cpp
@@ -47,24 +47,17 @@ void InterfaceMap::start(int id) {
_roomResID = bg->_resourceId;
_objs.push_back(bg);
- 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 = sys->findObject(infos[i].attachedObjIds[j]);
- FlicDecoder *flc = g_vm->resMgr()->loadFlic(obj->_resourceId);
- flc->setFrame(1);
- obj->_z = 1;
- obj->_x = 0;
- obj->_y = 0;
- obj->_frame = 1;
- obj->_animate = obj->_isShown;
- _objs.push_back(obj);
- }
- break;
+ const BGInfo *info = g_vm->getQSystem()->_mainInterface->findBGInfo(id);
+ for (uint i = 0; i < info->attachedObjIds.size(); ++i) {
+ QMessageObject *obj = sys->findObject(info->attachedObjIds[i]);
+ FlicDecoder *flc = g_vm->resMgr()->loadFlic(obj->_resourceId);
+ flc->setFrame(1);
+ obj->_z = 1;
+ obj->_x = 0;
+ obj->_y = 0;
+ obj->_frame = 1;
+ obj->_animate = obj->_isShown;
+ _objs.push_back(obj);
}
QObjectCursor *cursor = sys->getCursor();
diff --git a/engines/petka/interfaces/panel.cpp b/engines/petka/interfaces/panel.cpp
index 9324b79ece..b110bb002a 100644
--- a/engines/petka/interfaces/panel.cpp
+++ b/engines/petka/interfaces/panel.cpp
@@ -97,25 +97,19 @@ void InterfacePanel::start(int id) {
QObjectBG *bg = (QObjectBG *)g_vm->getQSystem()->findObject(kPanelObjName);
_objs.push_back(bg);
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 = sys->findObject(infos[i].attachedObjIds[j]);
- FlicDecoder *flc = g_vm->resMgr()->loadFlic(obj->_resourceId);
- flc->setFrame(1);
- obj->_z = 1;
- obj->_x = _objectPoints[j].x;
- obj->_y = _objectPoints[j].y;
- obj->_frame = 1;
- obj->_animate = 0;
- obj->_isShown = 1;
- _objs.push_back(obj);
- }
- break;
+ const BGInfo *info = g_vm->getQSystem()->_mainInterface->findBGInfo(id);
+ for (uint i = 0; i < info->attachedObjIds.size(); ++i) {
+ QMessageObject *obj = sys->findObject(info->attachedObjIds[i]);
+ FlicDecoder *flc = g_vm->resMgr()->loadFlic(obj->_resourceId);
+ flc->setFrame(1);
+ obj->_z = 1;
+ obj->_x = _objectPoints[i].x;
+ obj->_y = _objectPoints[i].y;
+ obj->_frame = 1;
+ obj->_animate = 0;
+ obj->_isShown = 1;
+ _objs.push_back(obj);
}
QObjectCursor *cursor = g_vm->getQSystem()->getCursor();
diff --git a/engines/petka/interfaces/startup.cpp b/engines/petka/interfaces/startup.cpp
index 57866c8f73..6792412ca5 100644
--- a/engines/petka/interfaces/startup.cpp
+++ b/engines/petka/interfaces/startup.cpp
@@ -59,23 +59,16 @@ void InterfaceStartup::start(int id) {
Sound *s = g_vm->soundMgr()->addSound(g_vm->resMgr()->findSoundName(bg->_musicId), Audio::Mixer::kMusicSoundType);
s->play(true);
- const Common::Array<BGInfo> &infos = g_vm->getQSystem()->_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]);
- obj->_z = 1;
- obj->_x = 0;
- obj->_y = 0;
- obj->_frame = 1;
- obj->_animate = 0;
- obj->_isShown = 0;
- _objs.push_back(obj);
- }
- break;
+ const BGInfo *info = g_vm->getQSystem()->_mainInterface->findBGInfo(id);
+ for (uint i = 0; i < info->attachedObjIds.size(); ++i) {
+ QMessageObject *obj = g_vm->getQSystem()->findObject(info->attachedObjIds[i]);
+ obj->_z = 1;
+ obj->_x = 0;
+ obj->_y = 0;
+ obj->_frame = 1;
+ obj->_animate = 0;
+ obj->_isShown = 0;
+ _objs.push_back(obj);
}
initCursor(kStartupCursorId, 1, 0);
Commit: 0a0c103f8a8c63908a2cd029ec51999200596bb5
https://github.com/scummvm/scummvm/commit/0a0c103f8a8c63908a2cd029ec51999200596bb5
Author: Andrei Prykhodko (whiterandrek at gmail.com)
Date: 2020-05-30T01:43:15+03:00
Commit Message:
PETKA: simplified room loading
Changed paths:
engines/petka/interfaces/main.cpp
engines/petka/interfaces/main.h
diff --git a/engines/petka/interfaces/main.cpp b/engines/petka/interfaces/main.cpp
index 3d4bb27a32..d194903469 100644
--- a/engines/petka/interfaces/main.cpp
+++ b/engines/petka/interfaces/main.cpp
@@ -91,35 +91,33 @@ void InterfaceMain::loadRoom(int id, bool fromSave) {
_roomId = id;
const BGInfo *info = findBGInfo(id);
QObjectBG *room = (QObjectBG *)sys->findObject(id);
- g_vm->getQSystem()->_room = room;
+ sys->_room = room;
g_vm->resMgr()->loadBitmap(room->_resourceId);
_objs.push_back(room);
for (uint i = 0; i < info->attachedObjIds.size(); ++i) {
- QMessageObject *obj = g_vm->getQSystem()->findObject(info->attachedObjIds[i]);
+ QMessageObject *obj = sys->findObject(info->attachedObjIds[i]);
obj->loadSound();
if (obj->_isShown || obj->_isActive)
g_vm->resMgr()->loadFlic(obj->_resourceId);
_objs.push_back(obj);
}
- if (sys->_musicId != room->_musicId) {
- g_vm->soundMgr()->removeSound(g_vm->resMgr()->findSoundName(sys->_musicId));
- Sound *sound = g_vm->soundMgr()->addSound(g_vm->resMgr()->findSoundName(room->_musicId), Audio::Mixer::kMusicSoundType);
- if (sound) {
- sound->play(true);
- }
- sys->_musicId = room->_musicId;
- }
- if (sys->_fxId != room->_fxId) {
- g_vm->soundMgr()->removeSound(g_vm->resMgr()->findSoundName(sys->_fxId));
- Sound *sound = g_vm->soundMgr()->addSound(g_vm->resMgr()->findSoundName(room->_fxId), Audio::Mixer::kMusicSoundType);
+ playSound(room->_musicId, Audio::Mixer::kMusicSoundType);
+ playSound(room->_fxId, Audio::Mixer::kSFXSoundType);
+ if (!fromSave)
+ sys->addMessageForAllObjects(kInitBG, 0, 0, 0, 0, room);
+ g_vm->videoSystem()->updateTime();
+}
+
+void InterfaceMain::playSound(int id, Audio::Mixer::SoundType type) {
+ int *sysId = (type == Audio::Mixer::kMusicSoundType) ? &g_vm->getQSystem()->_musicId : &g_vm->getQSystem()->_fxId;
+ if (*sysId != id) {
+ g_vm->soundMgr()->removeSound(g_vm->resMgr()->findSoundName(*sysId));
+ Sound *sound = g_vm->soundMgr()->addSound(g_vm->resMgr()->findSoundName(id), Audio::Mixer::kMusicSoundType); // kMusicSoundType intended
if (sound) {
sound->play(true);
}
- sys->_fxId = room->_fxId;
+ *sysId = id;
}
- if (!fromSave)
- g_vm->getQSystem()->addMessageForAllObjects(kInitBG, 0, 0, 0, 0, room);
- g_vm->videoSystem()->updateTime();
}
const BGInfo *InterfaceMain::findBGInfo(int id) const {
diff --git a/engines/petka/interfaces/main.h b/engines/petka/interfaces/main.h
index 215aebd27c..f0a8a7e889 100644
--- a/engines/petka/interfaces/main.h
+++ b/engines/petka/interfaces/main.h
@@ -56,6 +56,9 @@ public:
void removeTextDescription();
+private:
+ void playSound(int id, Audio::Mixer::SoundType type);
+
public:
DialogInterface _dialog;
Common::Array<BGInfo> _bgs;
Commit: 1f4ed583d27a038096fea6d94ebe97cdf60c6203
https://github.com/scummvm/scummvm/commit/1f4ed583d27a038096fea6d94ebe97cdf60c6203
Author: Andrei Prykhodko (whiterandrek at gmail.com)
Date: 2020-05-30T01:44:40+03:00
Commit Message:
PETKA: fix compilation
Changed paths:
engines/petka/interfaces/main.h
diff --git a/engines/petka/interfaces/main.h b/engines/petka/interfaces/main.h
index f0a8a7e889..43c37e7dcf 100644
--- a/engines/petka/interfaces/main.h
+++ b/engines/petka/interfaces/main.h
@@ -23,6 +23,8 @@
#ifndef PETKA_MAIN_H
#define PETKA_MAIN_H
+#include "audio/mixer.h"
+
#include "petka/interfaces/interface.h"
#include "petka/interfaces/dialog_interface.h"
More information about the Scummvm-git-logs
mailing list