mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-13 21:31:53 +00:00
MTROPOLIS: Add support for setting mToon range to a label. Fixes MTI Benbow moose head.
This commit is contained in:
parent
a23ffc82bb
commit
606a1d0eb6
@ -1553,6 +1553,26 @@ MiniscriptInstructionOutcome MToonElement::scriptSetRange(MiniscriptThread *thre
|
||||
return scriptSetRangeTyped(thread, value.getIntRange());
|
||||
if (value.getType() == DynamicValueTypes::kPoint)
|
||||
return scriptSetRangeTyped(thread, value.getPoint());
|
||||
if (value.getType() == DynamicValueTypes::kLabel) {
|
||||
const Common::String *nameStrPtr = thread->getRuntime()->getProject()->findNameOfLabel(value.getLabel());
|
||||
if (!nameStrPtr) {
|
||||
thread->error("mToon range label wasn't found");
|
||||
return kMiniscriptInstructionOutcomeFailed;
|
||||
}
|
||||
|
||||
if (!_metadata) {
|
||||
thread->error("mToon range couldn't be resolved because the metadata wasn't loaded yet");
|
||||
return kMiniscriptInstructionOutcomeFailed;
|
||||
}
|
||||
|
||||
for (const MToonMetadata::FrameRangeDef &frameRange : _metadata->frameRanges) {
|
||||
if (caseInsensitiveEqual(frameRange.name, *nameStrPtr))
|
||||
return scriptSetRangeTyped(thread, IntRange(frameRange.startFrame, frameRange.endFrame));
|
||||
}
|
||||
|
||||
thread->error("mToon range was assigned to a label but the label doesn't exist in the mToon data");
|
||||
return kMiniscriptInstructionOutcomeFailed;
|
||||
}
|
||||
|
||||
thread->error("Invalid type for mToon range");
|
||||
return kMiniscriptInstructionOutcomeFailed;
|
||||
|
@ -7104,6 +7104,23 @@ Common::SeekableReadStream* Project::getStreamForSegment(int segmentIndex) {
|
||||
return _segments[segmentIndex].weakStream;
|
||||
}
|
||||
|
||||
const Common::String *Project::findNameOfLabel(const Label &label) const {
|
||||
for (const LabelSuperGroup &superGroup : _labelSuperGroups) {
|
||||
if (superGroup.superGroupID == label.superGroupID) {
|
||||
size_t firstRootIndex = superGroup.firstRootNodeIndex;
|
||||
size_t totalNodes = superGroup.numTotalNodes;
|
||||
|
||||
for (size_t i = 0; i < totalNodes; i++) {
|
||||
const LabelTree &tree = _labelTree[i + firstRootIndex];
|
||||
if (tree.id == label.id)
|
||||
return &tree.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Common::SharedPtr<SegmentUnloadSignaller> Project::notifyOnSegmentUnload(int segmentIndex, ISegmentUnloadSignalReceiver *receiver) {
|
||||
Common::SharedPtr<SegmentUnloadSignaller> signaller = _segments[segmentIndex].unloadSignaller;
|
||||
if (signaller)
|
||||
@ -7372,6 +7389,7 @@ void Project::loadLabelMap(const Data::ProjectLabelMap &projectLabelMap) {
|
||||
sg.superGroupID = dataSG.id;
|
||||
|
||||
sg.firstRootNodeIndex = insertionOffset;
|
||||
sg.numRootNodes = dataSG.numChildren;
|
||||
|
||||
for (size_t j = 0; j < dataSG.numChildren; j++)
|
||||
treeQueue[insertionOffset++] = &dataSG.tree[j];
|
||||
|
@ -2385,6 +2385,8 @@ public:
|
||||
void closeSegmentStream(int segmentIndex);
|
||||
Common::SeekableReadStream *getStreamForSegment(int segmentIndex);
|
||||
|
||||
const Common::String *findNameOfLabel(const Label &label) const;
|
||||
|
||||
void onPostRender();
|
||||
void onKeyboardEvent(Runtime *runtime, const Common::EventType evtType, bool repeat, const Common::KeyState &keyEvt);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user