[Scummvm-git-logs] scummvm master -> 07285565b7a28f95a65a0955cf2d45d3929ed636
elasota
noreply at scummvm.org
Sun Oct 16 06:30:13 UTC 2022
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:
e9a6ef273f MTROPOLIS: Various MTI fixes.
5749d6a66e MTROPOLIS: Force render update when objects change position or visibility.
07285565b7 MTROPOLIS: Fix MTI credits not rendering correctly. Fix extra mToon frame being needlessly rendered.
Commit: e9a6ef273f002551539b199eb77d0736171ce695
https://github.com/scummvm/scummvm/commit/e9a6ef273f002551539b199eb77d0736171ce695
Author: elasota (ejlasota at gmail.com)
Date: 2022-10-16T02:29:16-04:00
Commit Message:
MTROPOLIS: Various MTI fixes.
Changed paths:
engines/mtropolis/assets.cpp
engines/mtropolis/assets.h
engines/mtropolis/data.cpp
engines/mtropolis/data.h
engines/mtropolis/elements.cpp
engines/mtropolis/runtime.cpp
engines/mtropolis/runtime.h
diff --git a/engines/mtropolis/assets.cpp b/engines/mtropolis/assets.cpp
index 587b8bf2c70..c99b8bbaa3a 100644
--- a/engines/mtropolis/assets.cpp
+++ b/engines/mtropolis/assets.cpp
@@ -1069,6 +1069,9 @@ bool MToonAsset::load(AssetLoaderContext &context, const Data::MToonAsset &data)
_frameDataPosition = data.frameDataPosition;
_sizeOfFrameData = data.sizeOfFrameData;
+ if (!data.registrationPoint.toScummVMPoint(_metadata->registrationPoint))
+ return false;
+
if (!data.rect.toScummVMRect(_metadata->rect))
return false;
diff --git a/engines/mtropolis/assets.h b/engines/mtropolis/assets.h
index 8c3c8d5f69c..4b9326e7aa4 100644
--- a/engines/mtropolis/assets.h
+++ b/engines/mtropolis/assets.h
@@ -92,6 +92,7 @@ struct MToonMetadata {
ImageFormat imageFormat;
Common::Rect rect;
+ Common::Point registrationPoint;
uint16 bitsPerPixel;
uint32 codecID;
uint32 encodingFlags;
diff --git a/engines/mtropolis/data.cpp b/engines/mtropolis/data.cpp
index 6a4be63d6ce..df22248806b 100644
--- a/engines/mtropolis/data.cpp
+++ b/engines/mtropolis/data.cpp
@@ -1962,9 +1962,9 @@ DataReadErrorCode ColorTableAsset::load(DataReader &reader) {
for (size_t i = 0; i < numColors; i++) {
ColorRGB16 &cdef = colors[i];
- cdef.red = cdefBytes[i * 4 + 2] * 0x101;
+ cdef.red = cdefBytes[i * 4 + 0] * 0x101;
cdef.green = cdefBytes[i * 4 + 1] * 0x101;
- cdef.blue = cdefBytes[i * 4 + 0] * 0x101;
+ cdef.blue = cdefBytes[i * 4 + 2] * 0x101;
}
} else
return kDataReadErrorUnrecognized;
@@ -2129,7 +2129,7 @@ MToonAsset::MToonAsset()
: marker(0), unknown1{0, 0, 0, 0, 0, 0, 0, 0}, assetID(0), haveMacPart(false), haveWinPart(false), frameDataPosition(0), sizeOfFrameData(0),
mtoonHeader{0, 0}, version(0), unknown2{0, 0, 0, 0}, encodingFlags(0), numFrames(0),
unknown3{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, bitsPerPixel(0), codecID(0), unknown4_1{0, 0, 0, 0, 0, 0, 0, 0},
- codecDataSize(0), unknown4_2{0, 0, 0, 0} {
+ codecDataSize(0) {
memset(&this->platform, 0, sizeof(this->platform));
}
@@ -2160,7 +2160,7 @@ DataReadErrorCode MToonAsset::load(DataReader &reader) {
|| !reader.readU32(mtoonHeader[1]) || !reader.readU16(version) || !reader.readBytes(unknown2)
|| !reader.readU32(encodingFlags) || !rect.load(reader) || !reader.readU16(numFrames)
|| !reader.readBytes(unknown3) || !reader.readU16(bitsPerPixel) || !reader.readU32(codecID)
- || !reader.readBytes(unknown4_1) || !reader.readU32(codecDataSize) || !reader.readBytes(unknown4_2))
+ || !reader.readBytes(unknown4_1) || !reader.readU32(codecDataSize) || !registrationPoint.load(reader))
return kDataReadErrorReadFailed;
if (mtoonHeader[0] != 0 || mtoonHeader[1] != 0x546f6f6e)
diff --git a/engines/mtropolis/data.h b/engines/mtropolis/data.h
index a263adc4e28..9b1728c071e 100644
--- a/engines/mtropolis/data.h
+++ b/engines/mtropolis/data.h
@@ -1997,7 +1997,7 @@ struct MToonAsset : public DataObject {
uint32 codecID;
uint8 unknown4_1[8];
uint32 codecDataSize;
- uint8 unknown4_2[4];
+ Point registrationPoint;
Common::Array<FrameDef> frames;
diff --git a/engines/mtropolis/elements.cpp b/engines/mtropolis/elements.cpp
index a9c71bcfb67..e2862dd6bb9 100644
--- a/engines/mtropolis/elements.cpp
+++ b/engines/mtropolis/elements.cpp
@@ -1158,6 +1158,9 @@ bool MToonElement::readAttribute(MiniscriptThread *thread, DynamicValue &result,
else
result.setInt(0);
return true;
+ } else if (attrib == "regpoint") {
+ result.setPoint(_cachedMToon->getMetadata()->registrationPoint);
+ return true;
}
return VisualElement::readAttribute(thread, result, attrib);
diff --git a/engines/mtropolis/runtime.cpp b/engines/mtropolis/runtime.cpp
index 004242c1b04..6072bd785d5 100644
--- a/engines/mtropolis/runtime.cpp
+++ b/engines/mtropolis/runtime.cpp
@@ -2054,9 +2054,20 @@ void MessengerSendSpec::resolveDestination(Runtime *runtime, Modifier *sender, C
if (sibling)
outStructuralDest = sibling;
} break;
+ case kMessageDestSourcesParent: {
+ // This sends to the exact parent, e.g. if the sender is inside of a behavior, then it sends it to the behavior.
+ if (sender) {
+ Common::SharedPtr<RuntimeObject> parentObj = sender->getParent().lock();
+ if (parentObj) {
+ if (parentObj->isModifier())
+ outModifierDest = parentObj->getSelfReference().staticCast<Modifier>();
+ else if (parentObj->isStructural())
+ outStructuralDest = parentObj->getSelfReference().staticCast<Structural>();
+ }
+ }
+ } break;
case kMessageDestChildren:
case kMessageDestSubsection:
- case kMessageDestSourcesParent:
case kMessageDestBehavior:
case kMessageDestBehaviorsParent:
warning("Not-yet-implemented message destination type");
@@ -2495,7 +2506,7 @@ void MessageProperties::setValue(const DynamicValue &value) {
_value = value;
}
-WorldManagerInterface::WorldManagerInterface() {
+WorldManagerInterface::WorldManagerInterface() : _gameMode(false) {
}
bool WorldManagerInterface::readAttribute(MiniscriptThread *thread, DynamicValue &result, const Common::String &attrib) {
@@ -2514,6 +2525,10 @@ bool WorldManagerInterface::readAttribute(MiniscriptThread *thread, DynamicValue
result.setInt(bitDepth);
return true;
}
+ else if (attrib == "gamemode") {
+ result.setBool(_gameMode);
+ return true;
+ }
return RuntimeObject::readAttribute(thread, result, attrib);
}
@@ -2535,6 +2550,10 @@ MiniscriptInstructionOutcome WorldManagerInterface::writeRefAttribute(Miniscript
DynamicValueWriteFuncHelper<WorldManagerInterface, &WorldManagerInterface::setWinSndBufferSize>::create(this, result);
return kMiniscriptInstructionOutcomeContinue;
}
+ if (attrib == "gamemode") {
+ DynamicValueWriteBoolHelper::create(&_gameMode, result);
+ return kMiniscriptInstructionOutcomeContinue;
+ }
return RuntimeObject::writeRefAttribute(thread, result, attrib);
}
diff --git a/engines/mtropolis/runtime.h b/engines/mtropolis/runtime.h
index 110fbc1a657..9d73cc923df 100644
--- a/engines/mtropolis/runtime.h
+++ b/engines/mtropolis/runtime.h
@@ -1978,6 +1978,8 @@ private:
MiniscriptInstructionOutcome setRefreshCursor(MiniscriptThread *thread, const DynamicValue &value);
MiniscriptInstructionOutcome setAutoResetCursor(MiniscriptThread *thread, const DynamicValue &value);
MiniscriptInstructionOutcome setWinSndBufferSize(MiniscriptThread *thread, const DynamicValue &value);
+
+ bool _gameMode;
};
class AssetManagerInterface : public RuntimeObject {
Commit: 5749d6a66edf19ab631734acb1b9989ad1b92cca
https://github.com/scummvm/scummvm/commit/5749d6a66edf19ab631734acb1b9989ad1b92cca
Author: elasota (ejlasota at gmail.com)
Date: 2022-10-16T02:29:17-04:00
Commit Message:
MTROPOLIS: Force render update when objects change position or visibility.
Changed paths:
engines/mtropolis/hacks.cpp
engines/mtropolis/runtime.cpp
engines/mtropolis/runtime.h
diff --git a/engines/mtropolis/hacks.cpp b/engines/mtropolis/hacks.cpp
index 9755010e10a..a250607d4fe 100644
--- a/engines/mtropolis/hacks.cpp
+++ b/engines/mtropolis/hacks.cpp
@@ -84,10 +84,10 @@ void ObsidianCorruptedAirTowerTransitionFix::onLoaded(Asset *asset, const Common
class ObsidianInventoryWindscreenHooks : public StructuralHooks {
public:
- void onSetPosition(Structural *structural, Common::Point &pt) override;
+ void onSetPosition(Runtime *runtime, Structural *structural, Common::Point &pt) override;
};
-void ObsidianInventoryWindscreenHooks::onSetPosition(Structural *structural, Common::Point &pt) {
+void ObsidianInventoryWindscreenHooks::onSetPosition(Runtime *runtime, Structural *structural, Common::Point &pt) {
if (pt.y < 480) {
// Set direct to screen so it draws over cinematics
static_cast<VisualElement *>(structural)->setDirectToScreen(true);
@@ -99,13 +99,13 @@ void ObsidianInventoryWindscreenHooks::onSetPosition(Structural *structural, Com
class ObsidianSecurityFormWidescreenHooks : public StructuralHooks {
public:
- void onSetPosition(Structural *structural, Common::Point &pt) override;
+ void onSetPosition(Runtime *runtime, Structural *structural, Common::Point &pt) override;
private:
Common::Array<uint32> _hiddenCards;
};
-void ObsidianSecurityFormWidescreenHooks::onSetPosition(Structural *structural, Common::Point &pt) {
+void ObsidianSecurityFormWidescreenHooks::onSetPosition(Runtime *runtime, Structural *structural, Common::Point &pt) {
bool cardVisibility = (pt.y > 480);
// Originally tried manipulating layer order but that's actually not a good solution because
@@ -138,11 +138,11 @@ void ObsidianSecurityFormWidescreenHooks::onSetPosition(Structural *structural,
if (cardVisibility) {
if (Common::find(_hiddenCards.begin(), _hiddenCards.end(), card->getStaticGUID()) != _hiddenCards.end())
- card->setVisible(true);
+ card->setVisible(runtime, true);
} else {
if (card->isVisible()) {
_hiddenCards.push_back(card->getStaticGUID());
- card->setVisible(false);
+ card->setVisible(runtime, false);
}
}
}
diff --git a/engines/mtropolis/runtime.cpp b/engines/mtropolis/runtime.cpp
index 6072bd785d5..ac6968e7917 100644
--- a/engines/mtropolis/runtime.cpp
+++ b/engines/mtropolis/runtime.cpp
@@ -2763,7 +2763,7 @@ MiniscriptInstructionOutcome AssetManagerInterface::writeRefAttribute(Miniscript
void StructuralHooks::onCreate(Structural *structural) {
}
-void StructuralHooks::onSetPosition(Structural *structural, Common::Point &pt) {
+void StructuralHooks::onSetPosition(Runtime *runtime, Structural *structural, Common::Point &pt) {
}
ProjectPresentationSettings::ProjectPresentationSettings() : width(640), height(480), bitsPerPixel(8) {
@@ -7511,8 +7511,11 @@ bool VisualElement::isVisible() const {
return _visible;
}
-void VisualElement::setVisible(bool visible) {
- _visible = visible;
+void VisualElement::setVisible(Runtime *runtime, bool visible) {
+ if (_visible != visible) {
+ runtime->setSceneGraphDirty();
+ _visible = visible;
+ }
}
bool VisualElement::isDirectToScreen() const {
@@ -7520,7 +7523,10 @@ bool VisualElement::isDirectToScreen() const {
}
void VisualElement::setDirectToScreen(bool directToScreen) {
- _directToScreen = directToScreen;
+ if (_directToScreen != directToScreen) {
+ _contentsDirty = true;
+ _directToScreen = directToScreen;
+ }
}
uint16 VisualElement::getLayer() const {
@@ -7528,7 +7534,10 @@ uint16 VisualElement::getLayer() const {
}
void VisualElement::setLayer(uint16 layer) {
- _layer = layer;
+ if (_layer != layer) {
+ _contentsDirty = true;
+ _layer = layer;
+ }
}
VThreadState VisualElement::consumeCommand(Runtime *runtime, const Common::SharedPtr<MessageProperties> &msg) {
@@ -7934,7 +7943,7 @@ MiniscriptInstructionOutcome VisualElement::scriptSetPosition(MiniscriptThread *
Common::Point destPoint = value.getPoint();
if (_hooks)
- _hooks->onSetPosition(this, destPoint);
+ _hooks->onSetPosition(thread->getRuntime(), this, destPoint);
int32 xDelta = destPoint.x - _rect.left;
int32 yDelta = destPoint.y - _rect.top;
@@ -7957,7 +7966,7 @@ MiniscriptInstructionOutcome VisualElement::scriptSetPositionX(MiniscriptThread
Common::Point updatedPoint = Common::Point(asInteger, _rect.top);
if (_hooks)
- _hooks->onSetPosition(this, updatedPoint);
+ _hooks->onSetPosition(thread->getRuntime(), this, updatedPoint);
int32 xDelta = updatedPoint.x - _rect.left;
int32 yDelta = updatedPoint.y - _rect.top;
@@ -7974,7 +7983,7 @@ MiniscriptInstructionOutcome VisualElement::scriptSetPositionY(MiniscriptThread
Common::Point updatedPoint = Common::Point(_rect.left, asInteger);
if (_hooks)
- _hooks->onSetPosition(this, updatedPoint);
+ _hooks->onSetPosition(thread->getRuntime(), this, updatedPoint);
int32 xDelta = updatedPoint.x - _rect.left;
int32 yDelta = updatedPoint.y - _rect.top;
@@ -8110,6 +8119,9 @@ void VisualElement::offsetTranslate(int32 xDelta, int32 yDelta, bool cachedOrigi
static_cast<VisualElement *>(element)->offsetTranslate(xDelta, yDelta, true);
}
}
+
+ if (xDelta != 0 || yDelta != 0)
+ _contentsDirty = true;
}
Common::Point VisualElement::getCenterPosition() const {
@@ -8118,7 +8130,7 @@ Common::Point VisualElement::getCenterPosition() const {
VThreadState VisualElement::changeVisibilityTask(const ChangeFlagTaskData &taskData) {
if (_visible != taskData.desiredFlag) {
- _visible = taskData.desiredFlag;
+ setVisible(taskData.runtime, taskData.desiredFlag);
Common::SharedPtr<MessageProperties> msgProps(new MessageProperties(Event(_visible ? EventIDs::kElementHide : EventIDs::kElementShow, 0), DynamicValue(), getSelfReference()));
Common::SharedPtr<MessageDispatch> dispatch(new MessageDispatch(msgProps, this, false, true, false));
diff --git a/engines/mtropolis/runtime.h b/engines/mtropolis/runtime.h
index 9d73cc923df..cf6214c07b4 100644
--- a/engines/mtropolis/runtime.h
+++ b/engines/mtropolis/runtime.h
@@ -2020,7 +2020,7 @@ public:
virtual ~StructuralHooks();
virtual void onCreate(Structural *structural);
- virtual void onSetPosition(Structural *structural, Common::Point &pt);
+ virtual void onSetPosition(Runtime *runtime, Structural *structural, Common::Point &pt);
};
class Structural : public RuntimeObject, public IModifierContainer, public IMessageConsumer, public Debuggable {
@@ -2592,7 +2592,7 @@ public:
VThreadState consumeCommand(Runtime *runtime, const Common::SharedPtr<MessageProperties> &msg) override;
bool isVisible() const;
- void setVisible(bool visible);
+ void setVisible(Runtime *runtime, bool visible);
bool isDirectToScreen() const;
void setDirectToScreen(bool directToScreen);
Commit: 07285565b7a28f95a65a0955cf2d45d3929ed636
https://github.com/scummvm/scummvm/commit/07285565b7a28f95a65a0955cf2d45d3929ed636
Author: elasota (ejlasota at gmail.com)
Date: 2022-10-16T02:29:18-04:00
Commit Message:
MTROPOLIS: Fix MTI credits not rendering correctly. Fix extra mToon frame being needlessly rendered.
Changed paths:
engines/mtropolis/assets.cpp
diff --git a/engines/mtropolis/assets.cpp b/engines/mtropolis/assets.cpp
index c99b8bbaa3a..dd5f6ab36ff 100644
--- a/engines/mtropolis/assets.cpp
+++ b/engines/mtropolis/assets.cpp
@@ -625,7 +625,7 @@ void CachedMToon::getOrRenderFrame(uint32 prevFrame, uint32 targetFrame, Common:
if (prevFrame == targetFrame)
return;
if (prevFrame < targetFrame)
- backStopFrame = prevFrame;
+ backStopFrame = prevFrame + 1;
}
firstFrameToRender = targetFrame;
@@ -644,7 +644,7 @@ void CachedMToon::getOrRenderFrame(uint32 prevFrame, uint32 targetFrame, Common:
for (size_t i = firstFrameToRender; i <= targetFrame; i++) {
if (_rleOptimizedFormat.bytesPerPixel == 1)
- decompressMToonRLE<uint8, 0x80u, 0>(_rleData[i], _rleData[i].data8, *surface, isBottomUp);
+ decompressMToonRLE<uint8, 0x80u, 0x80u>(_rleData[i], _rleData[i].data8, *surface, isBottomUp);
else if (_rleOptimizedFormat.bytesPerPixel == 2)
decompressMToonRLE<uint16, 0x8000u, 0x8000u>(_rleData[i], _rleData[i].data16, *surface, isBottomUp);
else if (_rleOptimizedFormat.bytesPerPixel == 4)
More information about the Scummvm-git-logs
mailing list