[Scummvm-git-logs] scummvm master -> be9372d817bcf230ff9ecc350477d7a423855e4a
whiterandrek
whiterandrek at gmail.com
Thu Oct 1 16:33:38 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:
965eda5514 PETKA: fixed compilation
be9372d817 PETKA: fixed objects positions when xOffset is not zero
Commit: 965eda55144f27469e0ebaf7531c4d4e81f9be4f
https://github.com/scummvm/scummvm/commit/965eda55144f27469e0ebaf7531c4d4e81f9be4f
Author: Andrei Prykhodko (whiterandrek at gmail.com)
Date: 2020-10-01T19:28:20+03:00
Commit Message:
PETKA: fixed compilation
Changed paths:
engines/petka/interfaces/panel.cpp
diff --git a/engines/petka/interfaces/panel.cpp b/engines/petka/interfaces/panel.cpp
index 7267ae7732..7aed5fdc2a 100644
--- a/engines/petka/interfaces/panel.cpp
+++ b/engines/petka/interfaces/panel.cpp
@@ -278,10 +278,10 @@ void InterfacePanel::readSettings() {
}
void InterfacePanel::applySettings() {
- _speechFrame = CLIP(_speechFrame, 1, 31);
- _musicFrame = CLIP(_musicFrame, 1, 41);
- _sfxFrame = CLIP(_sfxFrame, 1, 31);
- _speedFrame = CLIP(_speedFrame, 1, 26);
+ _speechFrame = CLIP<int>(_speechFrame, 1, 31);
+ _musicFrame = CLIP<int>(_musicFrame, 1, 41);
+ _sfxFrame = CLIP<int>(_sfxFrame, 1, 31);
+ _speedFrame = CLIP<int>(_speedFrame, 1, 26);
ConfMan.setInt("speech_volume", 255 * (_speechFrame - 1) / (31 - 1));
ConfMan.setInt("music_volume", 255 * (_musicFrame - 1) / (41 - 1));
Commit: be9372d817bcf230ff9ecc350477d7a423855e4a
https://github.com/scummvm/scummvm/commit/be9372d817bcf230ff9ecc350477d7a423855e4a
Author: Andrei Prykhodko (whiterandrek at gmail.com)
Date: 2020-10-01T19:32:49+03:00
Commit Message:
PETKA: fixed objects positions when xOffset is not zero
Changed paths:
engines/petka/objects/object.cpp
engines/petka/objects/object_case.cpp
engines/petka/objects/object_cursor.cpp
engines/petka/objects/object_star.cpp
engines/petka/video.cpp
diff --git a/engines/petka/objects/object.cpp b/engines/petka/objects/object.cpp
index 0613a4c944..a8ec8467b9 100644
--- a/engines/petka/objects/object.cpp
+++ b/engines/petka/objects/object.cpp
@@ -453,7 +453,8 @@ void QObject::draw() {
_startSound = false;
}
- Common::Rect screen(640, 480);
+ QSystem *sys = g_vm->getQSystem();
+ Common::Rect screen(640 + sys->_xOffset, 480);
Common::Rect dest(flc->getBounds());
dest.translate(_x, _y);
@@ -463,13 +464,16 @@ void QObject::draw() {
const Graphics::Surface *frame = flc->getCurrentFrame();
Graphics::Surface *s = frame->convertTo(g_system->getScreenFormat(), flc->getPalette());
- const Common::List<Common::Rect> &dirty = g_vm->videoSystem()->rects();
- for (Common::List<Common::Rect>::const_iterator it = dirty.begin(); it != dirty.end(); ++it) {
- Common::Rect destRect(intersect.findIntersectingRect(*it));
+ const Common::List<Common::Rect> &dirtyRects = g_vm->videoSystem()->rects();
+ for (Common::List<Common::Rect>::const_iterator it = dirtyRects.begin(); it != dirtyRects.end(); ++it) {
+ Common::Rect dirty = *it;
+ dirty.translate(sys->_xOffset, 0);
+ Common::Rect destRect(intersect.findIntersectingRect(dirty));
if (destRect.isEmpty())
continue;
Common::Rect srcRect(destRect);
srcRect.translate(-_x - flc->getPos().x, -_y - flc->getPos().y);
+ destRect.translate(-sys->_xOffset, 0);
g_vm->videoSystem()->transBlitFrom(*s, srcRect, destRect, flc->getTransColor(s->format));
}
s->free();
@@ -517,6 +521,7 @@ void QObject::update(int time) {
if (flc->getCurFrame() + 1 == (int32)flc->getFrameCount() / 2) {
g_vm->getQSystem()->addMessage(_id, kHalf, _resourceId, 0, 0, 0, 0);
}
+ g_vm->videoSystem()->addDirtyRect(Common::Point(_x, _y), *flc);
_time -= flc->getDelay();
}
}
diff --git a/engines/petka/objects/object_case.cpp b/engines/petka/objects/object_case.cpp
index 00ee5ed767..b15d3aae66 100644
--- a/engines/petka/objects/object_case.cpp
+++ b/engines/petka/objects/object_case.cpp
@@ -102,6 +102,8 @@ void QObjectCase::draw() {
FlicDecoder *flc = g_vm->resMgr()->loadFlic(kFirstButtonResourceId + _clickedObjIndex);
Graphics::Surface *s = flc->getCurrentFrame()->convertTo(g_system->getScreenFormat(), flc->getPalette());
+ QSystem *sys = g_vm->getQSystem();
+
const Common::List<Common::Rect> &dirty = g_vm->videoSystem()->rects();
const Common::Array<Common::Rect> &mskRects = flc->getMskRects();
@@ -109,7 +111,7 @@ void QObjectCase::draw() {
for (uint i = 0; i < mskRects.size(); ++i) {
Common::Rect destRect = mskRects[i].findIntersectingRect(*it);
Common::Rect srcRect = destRect;
- srcRect.translate(-flc->getPos().x - _x, -flc->getPos().y - _y);
+ srcRect.translate(-flc->getPos().x - _x + sys->_xOffset, -flc->getPos().y - _y);
g_vm->videoSystem()->transBlitFrom(*s, srcRect, destRect, flc->getTransColor(s->format));
}
}
@@ -120,19 +122,20 @@ void QObjectCase::draw() {
}
void QObjectCase::show(bool v) {
- _x = 0; // sys->xOffset
+ QSystem *sys = g_vm->getQSystem();
+ _x = sys->_xOffset;
QObject::show(v);
if (v) {
addItemObjects();
- QMessageObject *obj = g_vm->getQSystem()->findObject(kPoloska);
+ QMessageObject *obj = sys->findObject(kPoloska);
obj->_z = kPoloskaZ;
- obj->_x = 0; // sys->xOffset
+ obj->_x = sys->_xOffset;
- g_vm->getQSystem()->_mainInterface->_objs.push_back(obj);
+ sys->_mainInterface->_objs.push_back(obj);
} else {
removeObjects(true);
- g_vm->getQSystem()->_currInterface->_startIndex = 0;
+ sys->_currInterface->_startIndex = 0;
}
}
@@ -141,8 +144,9 @@ bool QObjectCase::isInPoint(Common::Point p) {
}
void QObjectCase::onMouseMove(Common::Point p) {
+ p.x -= _x;
FlicDecoder *flc = g_vm->resMgr()->loadFlic(kExitCaseResourceId);
- if (*(const byte *)flc->getCurrentFrame()->getBasePtr(p.x - _x, p.y - _y) != 0) {
+ if (*(const byte *)flc->getCurrentFrame()->getBasePtr(p.x - flc->getPos().x, p.y - flc->getPos().y) != 0) {
if (_clickedObjIndex != kCloseButton && _clickedObjIndex != kInvalidButton) {
flc = g_vm->resMgr()->loadFlic(kFirstButtonResourceId + _clickedObjIndex);
flc->setFrame(1);
@@ -153,7 +157,7 @@ void QObjectCase::onMouseMove(Common::Point p) {
uint i;
for (i = 0; i < kButtonsCount; ++i) {
flc = g_vm->resMgr()->loadFlic(kFirstButtonResourceId + i);
- if (flc->getMskRects()[0].contains(Common::Point(p.x - _x, p.y))) {
+ if (flc->getMskRects()[0].contains(p)) {
break;
}
}
@@ -204,19 +208,20 @@ void QObjectCase::onClick(Common::Point p) {
}
void QObjectCase::addItemObjects() {
- Common::Array<QVisibleObject *> &objs = g_vm->getQSystem()->_mainInterface->_objs;
+ QSystem *sys = g_vm->getQSystem();
+ Common::Array<QVisibleObject *> &objs = sys->_mainInterface->_objs;
removeObjects(false);
for (uint i = 0; i < objs.size(); ++i) {
if (objs[i]->_resourceId == kCaseResourceId) {
- g_vm->getQSystem()->_currInterface->_startIndex = i;
+ sys->_currInterface->_startIndex = i;
}
}
const uint size = (_itemIndex + kItemsOnPage >= _items.size()) ? _items.size() : (_itemIndex + kItemsOnPage);
for (uint i = _itemIndex; i < size; ++i) {
- QMessageObject *obj = g_vm->getQSystem()->findObject(_items[i]);
- obj->_x = _itemsLocation[i - _itemIndex].x;
+ QMessageObject *obj = sys->findObject(_items[i]);
+ obj->_x = sys->_xOffset + _itemsLocation[i - _itemIndex].x;
obj->_y = _itemsLocation[i - _itemIndex].y;
obj->_z = kItemZ;
g_vm->resMgr()->loadFlic(obj->_resourceId);
diff --git a/engines/petka/objects/object_cursor.cpp b/engines/petka/objects/object_cursor.cpp
index 10cdb088c0..55d426f927 100644
--- a/engines/petka/objects/object_cursor.cpp
+++ b/engines/petka/objects/object_cursor.cpp
@@ -90,6 +90,8 @@ void QObjectCursor::setPos(Common::Point p, bool center) {
flc->setFrame(1);
}
+ p.x = p.x - g_vm->getQSystem()->_xOffset;
+
g_vm->videoSystem()->addDirtyRect(Common::Point(_x, _y), flc->getBounds());
if (center) {
diff --git a/engines/petka/objects/object_star.cpp b/engines/petka/objects/object_star.cpp
index 443805506c..8d6287462e 100644
--- a/engines/petka/objects/object_star.cpp
+++ b/engines/petka/objects/object_star.cpp
@@ -33,7 +33,7 @@
namespace Petka {
-//const uint kFirstCursorId = 5001;
+const uint kFirstCursorId = 5001;
const uint kCaseButtonIndex = 0;
QObjectStar::QObjectStar() {
@@ -60,7 +60,7 @@ void QObjectStar::onMouseMove(Common::Point p) {
uint frame = (findButtonIndex(p.x - _x, p.y - _y) + 1) % 7 + 1;
FlicDecoder *flc = g_vm->resMgr()->loadFlic(_resourceId);
if (flc && flc->getCurFrame() + 1 != (int32)frame) {
- g_vm->videoSystem()->addDirtyRect(Common::Point(_x, _y), *flc);
+ g_vm->videoSystem()->addDirtyRect(Common::Point(_x - g_vm->getQSystem()->_xOffset, _y), *flc);
flc->setFrame(frame);
}
}
@@ -87,11 +87,13 @@ uint QObjectStar::findButtonIndex(int16 x, int16 y) const {
void QObjectStar::setPos(Common::Point p, bool) {
if (!_isShown) {
+ QSystem *sys = g_vm->getQSystem();
+
FlicDecoder *flc = g_vm->resMgr()->loadFlic(_resourceId);
- p.x = MAX<int16>(p.x - flc->getWidth() / 2, 0);
+ p.x = MAX<int16>(p.x - sys->_xOffset - flc->getWidth() / 2, 0);
p.y = MAX<int16>(p.y - flc->getHeight() / 2, 0);
- _x = MIN<int16>(p.x, 639 - flc->getWidth());
+ _x = MIN<int16>(p.x, 639 - flc->getWidth()) + sys->_xOffset;
_y = MIN<int16>(p.y, 479 - flc->getHeight());
}
}
diff --git a/engines/petka/video.cpp b/engines/petka/video.cpp
index 202b6db1fd..7b45feef54 100644
--- a/engines/petka/video.cpp
+++ b/engines/petka/video.cpp
@@ -100,6 +100,7 @@ void VideoSystem::addDirtyRect(Common::Point pos, Common::Rect rect) {
}
void VideoSystem::addDirtyRect(Common::Point pos, FlicDecoder &flc) {
+ pos.x = pos.x - g_vm->getQSystem()->_xOffset;
addDirtyRect(pos, flc.getBounds());
}
More information about the Scummvm-git-logs
mailing list