[Scummvm-git-logs] scummvm master -> d2f5651db0365f3b9d0ff4fc5762b1360643d55c
bluegr
noreply at scummvm.org
Sun Mar 29 21:22:20 UTC 2026
This automated email contains information about 6 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
4da0ad2810 NANCY: Initial handling of mouse cursors for Nancy10+
740e7b5e0d NANCY: Initial work on the new chunks for Nancy10+
df0abbd91f NANCY: Add new AR record stubs for Nancy10+
d388bc424f NANCY: Add a temporary hack to TBOX chunk data for Nancy10+
59eb7ea085 NANCY: Disable the inventory box for Nancy10+ and load the main UI
d2f5651db0 NANCY: Add handling for Bink videos in the main UI viewport of Nancy10+
Commit: 4da0ad281071104d8a364a705d84a24fce571874
https://github.com/scummvm/scummvm/commit/4da0ad281071104d8a364a705d84a24fce571874
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2026-03-30T00:20:49+03:00
Commit Message:
NANCY: Initial handling of mouse cursors for Nancy10+
Changed paths:
engines/nancy/cursor.cpp
diff --git a/engines/nancy/cursor.cpp b/engines/nancy/cursor.cpp
index f83367a0dd2..99891744485 100644
--- a/engines/nancy/cursor.cpp
+++ b/engines/nancy/cursor.cpp
@@ -74,12 +74,20 @@ void CursorManager::init(Common::SeekableReadStream *chunkStream) {
// cursor code in later games.
uint numCursors = _numCursorTypes * (g_nancy->getGameType() == kGameTypeVampire ? 2 : 3) + g_nancy->getStaticData().numItems * _numCursorTypes;
+ if (g_nancy->getGameType() >= kGameTypeNancy10) {
+ _numCursorTypes = 37;
+ numCursors = _numCursorTypes * 2 + g_nancy->getStaticData().numItems * 2;
+ }
+
_cursors.resize(numCursors);
for (uint i = 0; i < numCursors; ++i) {
readRect(*chunkStream, _cursors[i].bounds);
}
+ if (g_nancy->getGameType() >= kGameTypeNancy10)
+ chunkStream->skip(numCursors * 4 * 4); // TODO
+
for (uint i = 0; i < numCursors; ++i) {
_cursors[i].hotspot.x = chunkStream->readUint32LE();
_cursors[i].hotspot.y = chunkStream->readUint32LE();
@@ -127,10 +135,16 @@ void CursorManager::setCursor(CursorType type, int16 itemID) {
// value of the CursorType enum.
switch (type) {
case kNormalArrow:
- _curCursorID = _numCursorTypes;
+ if (gameType >= kGameTypeNancy10)
+ _curCursorID = 8;
+ else
+ _curCursorID = _numCursorTypes;
return;
case kHotspotArrow:
- _curCursorID = _numCursorTypes + 1;
+ if (gameType >= kGameTypeNancy10)
+ _curCursorID = 9;
+ else
+ _curCursorID = _numCursorTypes + 1;
return;
case kInvertedRotateLeft:
// Only valid for nancy6 and up
Commit: 740e7b5e0daf58655d398695e5584e6af1c2fb73
https://github.com/scummvm/scummvm/commit/740e7b5e0daf58655d398695e5584e6af1c2fb73
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2026-03-30T00:20:51+03:00
Commit Message:
NANCY: Initial work on the new chunks for Nancy10+
- Implemented differences of the BSUM, INV and TBOX chunks
- Implemented the SHUI chunk
- Added stubs for the SCTB, TASK, UIBW, UICL, UICO, UIIV, UINB chunks
- Removed the intermediate loadFontsNew() function
Changed paths:
engines/nancy/enginedata.cpp
engines/nancy/enginedata.h
engines/nancy/graphics.cpp
engines/nancy/graphics.h
engines/nancy/nancy.cpp
diff --git a/engines/nancy/enginedata.cpp b/engines/nancy/enginedata.cpp
index c67d7b014b3..cccdf0b341e 100644
--- a/engines/nancy/enginedata.cpp
+++ b/engines/nancy/enginedata.cpp
@@ -69,6 +69,8 @@ BSUM::BSUM(Common::SeekableReadStream *chunkStream) : EngineData(chunkStream) {
s.skip(1);
}
+ s.skip(4, kGameTypeNancy11); // Unknown
+
s.skip(8, kGameTypeVampire, kGameTypeVampire);
readRect(s, extraButtonHotspot, kGameTypeVampire, kGameTypeVampire);
readRect(s, extraButtonHotspot, kGameTypeNancy2);
@@ -76,12 +78,14 @@ BSUM::BSUM(Common::SeekableReadStream *chunkStream) : EngineData(chunkStream) {
s.skip(0x10, kGameTypeVampire, kGameTypeVampire);
readRect(s, textboxScreenPosition);
readRect(s, inventoryBoxScreenPosition);
- readRect(s, menuButtonSrc);
- readRect(s, helpButtonSrc);
- readRect(s, menuButtonDest);
- readRect(s, helpButtonDest);
- readRect(s, menuButtonHighlightSrc, kGameTypeNancy2);
- readRect(s, helpButtonHighlightSrc, kGameTypeNancy2);
+
+ readRect(s, menuButtonSrc, kGameTypeVampire, kGameTypeNancy9);
+ readRect(s, helpButtonSrc, kGameTypeVampire, kGameTypeNancy9);
+ readRect(s, menuButtonDest, kGameTypeVampire, kGameTypeNancy9);
+ readRect(s, helpButtonDest, kGameTypeVampire, kGameTypeNancy9);
+ readRect(s, menuButtonHighlightSrc, kGameTypeNancy2, kGameTypeNancy9);
+ readRect(s, helpButtonHighlightSrc, kGameTypeNancy2, kGameTypeNancy9);
+
readRect(s, clockHighlightSrc, kGameTypeNancy2);
s.skip(0x2, kGameTypeVampire, kGameTypeVampire);
@@ -108,6 +112,16 @@ BSUM::BSUM(Common::SeekableReadStream *chunkStream) : EngineData(chunkStream) {
s.syncAsByte(overrideMovementTimeDeltas);
s.syncAsSint16LE(slowMovementTimeDelta);
s.syncAsSint16LE(fastMovementTimeDelta);
+
+ // FIXME: Data fixup/HACK for Nancy12. The BSUM data format changed
+ // significantly, but we want to be able to start the game without
+ // crashing, even if the data is wrong.
+ if (g_nancy->getGameType() >= kGameTypeNancy12) {
+ numFonts = 18;
+ rTrans = 0;
+ gTrans = 31;
+ bTrans = 0;
+ }
}
VIEW::VIEW(Common::SeekableReadStream *chunkStream) : EngineData(chunkStream) {
@@ -124,20 +138,22 @@ INV::INV(Common::SeekableReadStream *chunkStream) : EngineData(chunkStream) {
Common::Serializer s(chunkStream, nullptr);
s.setVersion(g_nancy->getGameType());
- readRect(*chunkStream, scrollbarSrcBounds);
- s.syncAsUint16LE(scrollbarDefaultPos.x);
- s.syncAsUint16LE(scrollbarDefaultPos.y);
- s.syncAsUint16LE(scrollbarMaxScroll);
+ if (g_nancy->getGameType() <= kGameTypeNancy9) {
+ readRect(*chunkStream, scrollbarSrcBounds);
+ s.syncAsUint16LE(scrollbarDefaultPos.x);
+ s.syncAsUint16LE(scrollbarDefaultPos.y);
+ s.syncAsUint16LE(scrollbarMaxScroll);
- readRectArray(s, ornamentSrcs, 6, 6, kGameTypeVampire, kGameTypeNancy1);
- readRectArray(s, ornamentDests, 6, 6, kGameTypeVampire, kGameTypeNancy1);
+ readRectArray(s, ornamentSrcs, 6, 6, kGameTypeVampire, kGameTypeNancy1);
+ readRectArray(s, ornamentDests, 6, 6, kGameTypeVampire, kGameTypeNancy1);
- uint numFrames = g_nancy->getGameType() == kGameTypeVampire ? 10 : 7;
+ uint numFrames = g_nancy->getGameType() == kGameTypeVampire ? 10 : 7;
- readRectArray(s, curtainAnimationSrcs, numFrames * 2);
+ readRectArray(s, curtainAnimationSrcs, numFrames * 2);
- readRect(s, curtainsScreenPosition);
- s.syncAsUint16LE(curtainsFrameTime);
+ readRect(s, curtainsScreenPosition);
+ s.syncAsUint16LE(curtainsFrameTime);
+ }
s.syncAsUint16LE(captionAutoClearTime, kGameTypeNancy3);
@@ -147,7 +163,7 @@ INV::INV(Common::SeekableReadStream *chunkStream) : EngineData(chunkStream) {
s.skip(0x4, kGameTypeVampire, kGameTypeNancy1); // inventory box icons surface w/h
s.skip(0x4, kGameTypeVampire, kGameTypeNancy1); // inventory cursors surface w/h
- s.skip(0x10); // unknown rect, same size as a hotspot
+ s.skip(0x10, kGameTypeVampire, kGameTypeNancy9); // unknown rect, same size as a hotspot
byte textBuf[60];
@@ -224,7 +240,9 @@ TBOX::TBOX(Common::SeekableReadStream *chunkStream) : EngineData(chunkStream) {
readRect(*chunkStream, scrollbarSrcBounds);
- chunkStream->seek(0x20);
+ if (g_nancy->getGameType() <= kGameTypeNancy9)
+ chunkStream->seek(0x20);
+
readRect(*chunkStream, innerBoundingBox);
scrollbarDefaultPos.x = chunkStream->readUint16LE() - (isVampire ? 1 : 0);
@@ -236,8 +254,10 @@ TBOX::TBOX(Common::SeekableReadStream *chunkStream) : EngineData(chunkStream) {
leftOffset = chunkStream->readUint16LE() - 1;
rightOffset = chunkStream->readUint16LE();
- readRectArray(*chunkStream, ornamentSrcs, 14);
- readRectArray(*chunkStream, ornamentDests, 14);
+ if (g_nancy->getGameType() <= kGameTypeNancy9) {
+ readRectArray(*chunkStream, ornamentSrcs, 14);
+ readRectArray(*chunkStream, ornamentDests, 14);
+ }
defaultFontID = chunkStream->readUint16LE();
defaultTextColor = chunkStream->readUint16LE();
@@ -829,4 +849,45 @@ MARK::MARK(Common::SeekableReadStream *chunkStream) : EngineData(chunkStream) {
readRectArray(*chunkStream, _markSrcs, 5);
}
+SCTB::SCTB(Common::SeekableReadStream *chunkStream) : EngineData(chunkStream) {
+ readFilename(*chunkStream, imageName);
+ // TODO
+}
+
+SHUI::SHUI(Common::SeekableReadStream *chunkStream) : EngineData(chunkStream) {
+ readRectArray(*chunkStream, _closeRects, 4);
+ readRectArray(*chunkStream, _sliderRects, 4);
+}
+
+TASK::TASK(Common::SeekableReadStream *chunkStream) : EngineData(chunkStream) {
+ chunkStream->skip(97);
+ readFilename(*chunkStream, imageName);
+ // TODO
+}
+
+UIBW::UIBW(Common::SeekableReadStream *chunkStream) : EngineData(chunkStream) {
+ readFilename(*chunkStream, imageName);
+ // TODO
+}
+
+UICL::UICL(Common::SeekableReadStream *chunkStream) : EngineData(chunkStream) {
+ readFilename(*chunkStream, imageName);
+ // TODO
+}
+
+UICO::UICO(Common::SeekableReadStream *chunkStream) : EngineData(chunkStream) {
+ readFilename(*chunkStream, imageName);
+ // TODO
+}
+
+UIIV::UIIV(Common::SeekableReadStream *chunkStream) : EngineData(chunkStream) {
+ readFilename(*chunkStream, imageName);
+ // TODO
+}
+
+UINB::UINB(Common::SeekableReadStream *chunkStream) : EngineData(chunkStream) {
+ readFilename(*chunkStream, imageName);
+ // TODO
+}
+
} // End of namespace Nancy
diff --git a/engines/nancy/enginedata.h b/engines/nancy/enginedata.h
index f88540b8064..e6124a002b9 100644
--- a/engines/nancy/enginedata.h
+++ b/engines/nancy/enginedata.h
@@ -485,6 +485,62 @@ struct MARK : public EngineData {
Common::Array<Common::Rect> _markSrcs;
};
+// Shared UI elements. Introduced in Nancy 10
+struct SHUI : public EngineData {
+ SHUI(Common::SeekableReadStream *chunkStream);
+
+ Common::Array<Common::Rect> _closeRects; // Close/"X" button rects
+ Common::Array<Common::Rect> _sliderRects; // Slider rects
+};
+
+// Scheduled talk (?) UI. Introduced in Nancy 11
+struct SCTB : public EngineData {
+ SCTB(Common::SeekableReadStream *chunkStream);
+
+ Common::Path imageName;
+};
+
+// New task list UI. Introduced in Nancy 10
+struct TASK : public EngineData {
+ TASK(Common::SeekableReadStream *chunkStream);
+
+ Common::Path imageName;
+};
+
+// New web browser UI. Introduced in Nancy 10
+struct UIBW : public EngineData {
+ UIBW(Common::SeekableReadStream *chunkStream);
+
+ Common::Path imageName;
+};
+
+// New cell phone popup UI. Introduced in Nancy 10
+struct UICL : public EngineData {
+ UICL(Common::SeekableReadStream *chunkStream);
+
+ Common::Path imageName;
+};
+
+// New conversation popup UI. Introduced in Nancy 10
+struct UICO : public EngineData {
+ UICO(Common::SeekableReadStream *chunkStream);
+
+ Common::Path imageName;
+};
+
+// New inventory UI. Introduced in Nancy 10
+struct UIIV : public EngineData {
+ UIIV(Common::SeekableReadStream *chunkStream);
+
+ Common::Path imageName;
+};
+
+// New notebook UI. Introduced in Nancy 10
+struct UINB : public EngineData {
+ UINB(Common::SeekableReadStream *chunkStream);
+
+ Common::Path imageName;
+};
} // End of namespace Nancy
#endif // NANCY_ENGINEDATA_H
diff --git a/engines/nancy/graphics.cpp b/engines/nancy/graphics.cpp
index a1cd1955424..ca3e640640b 100644
--- a/engines/nancy/graphics.cpp
+++ b/engines/nancy/graphics.cpp
@@ -177,18 +177,6 @@ void GraphicsManager::loadFonts(Common::SeekableReadStream *chunkStream) {
delete chunkStream;
}
-void GraphicsManager::loadFontsNew(Common::SeekableReadStream *chunkStream, uint16 fontCount) {
- assert(chunkStream);
-
- chunkStream->seek(0);
- _fonts.resize(fontCount);
- for (uint i = 0; i < _fonts.size(); ++i) {
- _fonts[i].read(*chunkStream);
- }
-
- delete chunkStream;
-}
-
void GraphicsManager::addObject(RenderObject *object) {
for (auto &r : _objects) {
if (r == object) {
diff --git a/engines/nancy/graphics.h b/engines/nancy/graphics.h
index 2fe08fe0775..bde9a4cc283 100644
--- a/engines/nancy/graphics.h
+++ b/engines/nancy/graphics.h
@@ -43,7 +43,6 @@ public:
void draw(bool updateScreen = true);
void loadFonts(Common::SeekableReadStream *chunkStream);
- void loadFontsNew(Common::SeekableReadStream *chunkStream, uint16 fontCount);
void addObject(RenderObject *object);
void removeObject(RenderObject *object);
diff --git a/engines/nancy/nancy.cpp b/engines/nancy/nancy.cpp
index 7d50665e204..4a31155579c 100644
--- a/engines/nancy/nancy.cpp
+++ b/engines/nancy/nancy.cpp
@@ -481,16 +481,16 @@ void NancyEngine::bootGameEngine() {
// Nancy 10+
// FONT chunk has been moved into a separate file
// FR0 chunk has been removed
- //LOAD_BOOT(SHUI)
- //LOAD_BOOT(TASK)
- //LOAD_BOOT(UIIV)
- //LOAD_BOOT(UICO)
- //LOAD_BOOT(UICL)
- //LOAD_BOOT(UIBW)
- //LOAD_BOOT(UINB)
+ LOAD_BOOT(SHUI) // Shared UI elements
+ LOAD_BOOT(TASK) // Task list UI
+ LOAD_BOOT(UIIV) // Inventory UI
+ LOAD_BOOT(UICO) // Conversation UI
+ LOAD_BOOT(UICL) // Cell phone UI
+ LOAD_BOOT(UIBW) // Web browser UI
+ LOAD_BOOT(UINB) // Notebook UI
// Nancy 11+
- // LOAD_BOOT(SCTB)
+ LOAD_BOOT(SCTB) // Scheduled talk (?) UI
// Nancy 12+
// HINT chunk has been removed
@@ -511,8 +511,7 @@ void NancyEngine::bootGameEngine() {
IFF *fontIFF = _resource->loadIFF("font");
if (!fontIFF)
error("Failed to load font IFF");
- // TODO: font count is hardcoded to 18 for now
- _graphics->loadFontsNew(fontIFF->getChunkStream("FONT"), 18);
+ _graphics->loadFonts(fontIFF->getChunkStream("FONT"));
delete fontIFF;
}
Commit: df0abbd91f13be2454fe4ff3a58cb1f780d0d0ee
https://github.com/scummvm/scummvm/commit/df0abbd91f13be2454fe4ff3a58cb1f780d0d0ee
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2026-03-30T00:20:52+03:00
Commit Message:
NANCY: Add new AR record stubs for Nancy10+
Changed paths:
engines/nancy/action/arfactory.cpp
engines/nancy/action/navigationrecords.cpp
diff --git a/engines/nancy/action/arfactory.cpp b/engines/nancy/action/arfactory.cpp
index fa129aacf89..9d7dd58cdc3 100644
--- a/engines/nancy/action/arfactory.cpp
+++ b/engines/nancy/action/arfactory.cpp
@@ -113,9 +113,17 @@ ActionRecord *ActionManager::createActionRecord(uint16 type, Common::SeekableRea
return new HotMultiframeSceneChange(CursorManager::kMoveDown);
}
case 22:
- return new Hot1FrSceneChange(CursorManager::kMoveLeft);
+ if (g_nancy->getGameType() <= kGameTypeNancy9) {
+ return new Hot1FrSceneChange(CursorManager::kMoveLeft);
+ } else {
+ return new HotMultiframeSceneChange(CursorManager::kMoveLeft);
+ }
case 23:
- return new Hot1FrSceneChange(CursorManager::kMoveRight);
+ if (g_nancy->getGameType() <= kGameTypeNancy9) {
+ return new Hot1FrSceneChange(CursorManager::kMoveRight);
+ } else {
+ return new HotMultiframeSceneChange(CursorManager::kMoveRight);
+ }
case 24:
return new HotMultiframeMultisceneCursorTypeSceneChange();
case 25: {
@@ -132,6 +140,10 @@ ActionRecord *ActionManager::createActionRecord(uint16 type, Common::SeekableRea
}
case 26:
return new InteractiveVideo();
+ case 29:
+ // Nancy 10+
+ warning("ControlUIItems - not implemented yet");
+ return nullptr;
case 40:
if (g_nancy->getGameType() < kGameTypeNancy2) {
// Only used in TVD
@@ -288,6 +300,14 @@ ActionRecord *ActionManager::createActionRecord(uint16 type, Common::SeekableRea
return new PopInvViewPriorScene();
case 126:
return new GoInvViewScene();
+ case 130:
+ // Nancy 10+
+ warning("ChangeCellPhoneInfo - not implemented yet");
+ return nullptr;
+ case 131:
+ // Nancy 10+
+ warning("AddSearchLink - not implemented yet");
+ return nullptr;
case 140:
return new SetVolume();
case 148:
diff --git a/engines/nancy/action/navigationrecords.cpp b/engines/nancy/action/navigationrecords.cpp
index 45ac45e485a..f3fe72a153a 100644
--- a/engines/nancy/action/navigationrecords.cpp
+++ b/engines/nancy/action/navigationrecords.cpp
@@ -75,6 +75,8 @@ void Hot1FrSceneChange::readData(Common::SeekableReadStream &stream) {
if (!_isTerse) {
SceneChange::readData(stream);
_hotspotDesc.readData(stream);
+ if (g_nancy->getGameType() >= kGameTypeNancy10)
+ stream.skip(14); // TODO
} else {
_sceneChange.sceneID = stream.readUint16LE();
_sceneChange.continueSceneSound = kContinueSceneSound;
Commit: d388bc424f11a9001f73b55d5787677319ca4dac
https://github.com/scummvm/scummvm/commit/d388bc424f11a9001f73b55d5787677319ca4dac
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2026-03-30T00:21:11+03:00
Commit Message:
NANCY: Add a temporary hack to TBOX chunk data for Nancy10+
Changed paths:
engines/nancy/enginedata.cpp
diff --git a/engines/nancy/enginedata.cpp b/engines/nancy/enginedata.cpp
index cccdf0b341e..11ca6d02722 100644
--- a/engines/nancy/enginedata.cpp
+++ b/engines/nancy/enginedata.cpp
@@ -294,6 +294,13 @@ TBOX::TBOX(Common::SeekableReadStream *chunkStream) : EngineData(chunkStream) {
} else {
textBackground = highlightTextBackground = 0;
}
+
+ // FIXME: Data fixup/HACK for Nancy10 and later
+ if (g_nancy->getGameType() >= kGameTypeNancy10) {
+ highlightConversationFontID = conversationFontID;
+ tabWidth = 4;
+ leftOffset = rightOffset = 0;
+ }
}
MAP::MAP(Common::SeekableReadStream *chunkStream) : EngineData(chunkStream) {
Commit: 59eb7ea0857a86946d3f7d5298c73705b416236f
https://github.com/scummvm/scummvm/commit/59eb7ea0857a86946d3f7d5298c73705b416236f
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2026-03-30T00:21:12+03:00
Commit Message:
NANCY: Disable the inventory box for Nancy10+ and load the main UI
- There is no inventory box in the main screen of Nancy10+
- Load the main UI graphics, adapting for the removed FR0 chunk
Changed paths:
engines/nancy/state/scene.cpp
diff --git a/engines/nancy/state/scene.cpp b/engines/nancy/state/scene.cpp
index 58af4576895..97998820aec 100644
--- a/engines/nancy/state/scene.cpp
+++ b/engines/nancy/state/scene.cpp
@@ -588,7 +588,10 @@ void Scene::registerGraphics() {
_frame.registerGraphics();
_viewport.registerGraphics();
_textbox.registerGraphics();
- _inventoryBox.registerGraphics();
+
+ if (g_nancy->getGameType() <= kGameTypeNancy9)
+ _inventoryBox.registerGraphics();
+
_hotspotDebug.registerGraphics();
if (_menuButton) {
@@ -1192,15 +1195,22 @@ void Scene::initStaticData() {
auto *bootSummary = GetEngineData(BSUM);
assert(bootSummary);
- const ImageChunk *fr0 = (const ImageChunk *)g_nancy->getEngineData("FR0");
- assert(fr0);
+ Common::Path imageName = "FRAME";
+
+ if (g_nancy->getGameType() <= kGameTypeNancy9) {
+ const ImageChunk *fr0 = (const ImageChunk *)g_nancy->getEngineData("FR0");
+ assert(fr0);
+ imageName = fr0->imageName;
+ }
auto *mapData = GetEngineData(MAP);
- _frame.init(fr0->imageName);
+ _frame.init(imageName);
_viewport.init();
_textbox.init();
- _inventoryBox.init();
+
+ if (g_nancy->getGameType() <= kGameTypeNancy9)
+ _inventoryBox.init();
// Init buttons
if (g_nancy->getGameType() == kGameTypeVampire) {
Commit: d2f5651db0365f3b9d0ff4fc5762b1360643d55c
https://github.com/scummvm/scummvm/commit/d2f5651db0365f3b9d0ff4fc5762b1360643d55c
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2026-03-30T00:21:14+03:00
Commit Message:
NANCY: Add handling for Bink videos in the main UI viewport of Nancy10+
Changed paths:
engines/nancy/ui/viewport.cpp
engines/nancy/ui/viewport.h
diff --git a/engines/nancy/ui/viewport.cpp b/engines/nancy/ui/viewport.cpp
index b7199aaade0..47280a9d807 100644
--- a/engines/nancy/ui/viewport.cpp
+++ b/engines/nancy/ui/viewport.cpp
@@ -32,6 +32,7 @@
#include "engines/nancy/ui/viewport.h"
#include "common/config-manager.h"
+#include "video/bink_decoder.h"
namespace Nancy {
namespace UI {
@@ -213,11 +214,38 @@ void Viewport::handleInput(NancyInput &input) {
}
void Viewport::loadVideo(const Common::Path &filename, uint frameNr, uint verticalScroll, byte panningType, uint16 format, const Common::Path &palette) {
- if (_decoder.isVideoLoaded()) {
- _decoder.close();
+ if (_decoder->isVideoLoaded()) {
+ _decoder->close();
}
- if (!_decoder.loadFile(filename.append(".avf"))) {
+ Common::String suffix;
+
+ if (_videoType == kVideoPlaytypeAVF) {
+ suffix = ".avf";
+
+ if (!Common::File::exists(filename.append(".avf"))) {
+ if (Common::File::exists(filename.append(".bik"))) {
+ suffix = ".bik";
+ _videoType = kVideoPlaytypeBink;
+ _decoder.reset(new Video::BinkDecoder());
+ } else {
+ error("Couldn't load video file %s.avf or %s.bik", filename.toString().c_str(), filename.toString().c_str());
+ }
+ }
+ } else {
+ suffix = ".bik";
+ if (!Common::File::exists(filename.append(".bik"))) {
+ if (Common::File::exists(filename.append(".avf"))) {
+ suffix = ".avf";
+ _videoType = kVideoPlaytypeAVF;
+ _decoder.reset(new AVFDecoder());
+ } else {
+ error("Couldn't load video file %s.avf or %s.bik", filename.toString().c_str(), filename.toString().c_str());
+ }
+ }
+ }
+
+ if (!_decoder->loadFile(filename.append(suffix))) {
error("Couldn't load video file %s", filename.toString().c_str());
}
@@ -240,10 +268,19 @@ void Viewport::loadVideo(const Common::Path &filename, uint frameNr, uint vertic
}
void Viewport::setFrame(uint frameNr) {
- assert(frameNr < _decoder.getFrameCount());
+ assert(frameNr < _decoder->getFrameCount());
- const Graphics::Surface *newFrame = _decoder.decodeFrame(frameNr);
- _decoder.seek(frameNr); // Seek to take advantage of caching
+ const Graphics::Surface *newFrame;
+
+ if (_videoType == kVideoPlaytypeAVF) {
+ AVFDecoder *decoder = dynamic_cast<AVFDecoder *>(_decoder.get());
+ newFrame = decoder->decodeFrame(frameNr);
+ decoder->seek(frameNr); // Seek to take advantage of caching
+ } else {
+ Video::BinkDecoder *decoder = dynamic_cast<Video::BinkDecoder *>(_decoder.get());
+ decoder->seek(frameNr); // Seek to take advantage of caching
+ newFrame = decoder->decodeNextFrame();
+ }
// Format 1 uses quarter-size images, while format 2 uses full-size ones
// Videos in TVD are always upside-down
diff --git a/engines/nancy/ui/viewport.h b/engines/nancy/ui/viewport.h
index 547d92d5f0d..c44b47210b4 100644
--- a/engines/nancy/ui/viewport.h
+++ b/engines/nancy/ui/viewport.h
@@ -48,10 +48,10 @@ public:
_videoFormat(kLargeVideoFormat),
_stickyCursorPos(-1, -1),
_panningType(kPanNone),
- _decoder(AVFDecoder::kLoadBidirectional),
+ _decoder(new AVFDecoder(AVFDecoder::kLoadBidirectional)),
_autoMove(false) {}
- virtual ~Viewport() { _decoder.close(); _fullFrame.free(); }
+ virtual ~Viewport() { _decoder->close(); _fullFrame.free(); }
void init() override;
void handleInput(NancyInput &input);
@@ -66,7 +66,7 @@ public:
void scrollUp(uint delta);
void scrollDown(uint delta);
- uint16 getFrameCount() const { return _decoder.isVideoLoaded() ? _decoder.getFrameCount() : 0; }
+ uint16 getFrameCount() const { return _decoder->isVideoLoaded() ? _decoder->getFrameCount() : 0; }
uint16 getCurFrame() const { return _currentFrame; }
uint16 getCurVerticalScroll() const { return _drawSurface.getOffsetFromOwner().y; }
uint16 getMaxScroll() const;
@@ -88,7 +88,8 @@ protected:
byte _panningType;
- AVFDecoder _decoder;
+ Common::ScopedPtr<Video::VideoDecoder> _decoder;
+ uint16 _videoType = kVideoPlaytypeAVF;
uint16 _currentFrame;
uint16 _videoFormat;
Graphics::ManagedSurface _fullFrame;
More information about the Scummvm-git-logs
mailing list