[Scummvm-git-logs] scummvm master -> 987b78182cdbe4e517c1bfbed4b08b7af4d0fa04
elasota
noreply at scummvm.org
Tue Jul 5 02:22:26 UTC 2022
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
987b78182c MTROPOLIS: Hide keycards when viewing security form with 16:9 widescreen mod enabled.
Commit: 987b78182cdbe4e517c1bfbed4b08b7af4d0fa04
https://github.com/scummvm/scummvm/commit/987b78182cdbe4e517c1bfbed4b08b7af4d0fa04
Author: elasota (ejlasota at gmail.com)
Date: 2022-07-04T22:21:51-04:00
Commit Message:
MTROPOLIS: Hide keycards when viewing security form with 16:9 widescreen mod enabled.
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 824127a5957..0dde0a13be9 100644
--- a/engines/mtropolis/hacks.cpp
+++ b/engines/mtropolis/hacks.cpp
@@ -86,6 +86,61 @@ void ObsidianInventoryWindscreenHooks::onSetPosition(Structural *structural, Com
}
}
+class ObsidianSecurityFormWindscreenHooks : public StructuralHooks {
+public:
+ void onSetPosition(Structural *structural, Common::Point &pt) override;
+
+private:
+ Common::Array<uint32> _hiddenCards;
+};
+
+void ObsidianSecurityFormWindscreenHooks::onSetPosition(Structural *structural, Common::Point &pt) {
+ bool cardVisibility = (pt.y > 480);
+
+ // Originally tried manipulating layer order but that's actually not a good solution because
+ // the form graphic is not actually dismissed until the cinematic completes. It's normally not
+ // visible because the cinematic is drawn over it, but managing that vis-a-vis the cards is a mess,
+ // and the form graphic actually includes a bit of area to the left due to the vidbot's arm being
+ // on the desk, which partially overlaps the cards, but not completely.
+ Structural *subsection = structural->getParent()->getParent();
+ assert(subsection->isSubsection());
+
+ Structural *sharedScene = subsection->getChildren()[0].get();
+ assert(sharedScene);
+
+ Structural *cards = nullptr;
+ for (const Common::SharedPtr<Structural> &child : sharedScene->getChildren()) {
+ if (child->getName() == "Inventory Cards") {
+ cards = child.get();
+ break;
+ }
+ }
+
+ if (!cardVisibility)
+ _hiddenCards.clear();
+
+ if (cards) {
+ for (const Common::SharedPtr<Structural> &child : cards->getChildren()) {
+ assert(child->isElement() && static_cast<Element *>(child.get())->isVisual());
+
+ VisualElement *card = static_cast<VisualElement *>(child.get());
+
+ if (cardVisibility) {
+ if (Common::find(_hiddenCards.begin(), _hiddenCards.end(), card->getStaticGUID()) != _hiddenCards.end())
+ card->setVisible(true);
+ } else {
+ if (card->isVisible()) {
+ _hiddenCards.push_back(card->getStaticGUID());
+ card->setVisible(false);
+ }
+ }
+ }
+ }
+
+ if (cardVisibility)
+ _hiddenCards.clear();
+}
+
void addObsidianBugFixes(const MTropolisGameDescription &desc, Hacks &hacks) {
// Workaround for bug in Obsidian:
// When opening the journal in the intro, a script checks if cGSt.cfst.binjournal is false and if so,
@@ -167,10 +222,14 @@ void addObsidianImprovedWidescreen(const MTropolisGameDescription &desc, Hacks &
0x5ecdee,
};
+ const uint32 cubeMazeSecurityFormGUID = 0x9602ec;
+
Common::SharedPtr<StructuralHooks> invItemHooks(new ObsidianInventoryWindscreenHooks());
for (uint32 guid : inventoryItemGUIDs)
hacks.addStructuralHooks(guid, invItemHooks);
+
+ hacks.addStructuralHooks(cubeMazeSecurityFormGUID, Common::SharedPtr<StructuralHooks>(new ObsidianSecurityFormWindscreenHooks()));
}
if ((desc.desc.flags & ADGF_DEMO) == 0 && desc.desc.language == Common::EN_ANY && desc.desc.platform == Common::kPlatformMacintosh) {
const uint32 inventoryItemGUIDs[] = {
@@ -235,10 +294,14 @@ void addObsidianImprovedWidescreen(const MTropolisGameDescription &desc, Hacks &
0x5ecdee,
};
+ const uint32 cubeMazeSecurityFormGUID = 0x9602ec;
+
Common::SharedPtr<StructuralHooks> invItemHooks(new ObsidianInventoryWindscreenHooks());
for (uint32 guid : inventoryItemGUIDs)
hacks.addStructuralHooks(guid, invItemHooks);
+
+ hacks.addStructuralHooks(cubeMazeSecurityFormGUID, Common::SharedPtr<StructuralHooks>(new ObsidianSecurityFormWindscreenHooks()));
}
}
diff --git a/engines/mtropolis/runtime.cpp b/engines/mtropolis/runtime.cpp
index d57bd54cac3..7e18f8688b0 100644
--- a/engines/mtropolis/runtime.cpp
+++ b/engines/mtropolis/runtime.cpp
@@ -6867,6 +6867,10 @@ bool VisualElement::isVisible() const {
return _visible;
}
+void VisualElement::setVisible(bool visible) {
+ _visible = visible;
+}
+
bool VisualElement::isDirectToScreen() const {
return _directToScreen;
}
@@ -6879,6 +6883,10 @@ uint16 VisualElement::getLayer() const {
return _layer;
}
+void VisualElement::setLayer(uint16 layer) {
+ _layer = layer;
+}
+
VThreadState VisualElement::consumeCommand(Runtime *runtime, const Common::SharedPtr<MessageProperties> &msg) {
if (Event::create(EventIDs::kElementShow, 0).respondsTo(msg->getEvent())) {
if (!_visible) {
diff --git a/engines/mtropolis/runtime.h b/engines/mtropolis/runtime.h
index 1b3f4b94ef8..69ebbca804b 100644
--- a/engines/mtropolis/runtime.h
+++ b/engines/mtropolis/runtime.h
@@ -2429,9 +2429,13 @@ public:
VThreadState consumeCommand(Runtime *runtime, const Common::SharedPtr<MessageProperties> &msg);
bool isVisible() const;
+ void setVisible(bool visible);
+
bool isDirectToScreen() const;
void setDirectToScreen(bool directToScreen);
+
uint16 getLayer() const;
+ void setLayer(uint16 layer);
bool isMouseInsideDrawableArea(int32 relativeX, int32 relativeY) const;
More information about the Scummvm-git-logs
mailing list