NANCY: Add support for small format secondary video

Secondary videos with a small video format now get displayed properly.
Added constants for small and large video formats.
This commit is contained in:
Kaloyan Chehlarski 2023-03-25 19:08:20 +02:00
parent c246c5cdd9
commit 87fcd3c93d
8 changed files with 21 additions and 13 deletions

View File

@ -153,7 +153,7 @@ void PlayPrimaryVideoChan0::updateGraphics() {
}
if (_decoder.needsUpdate()) {
GraphicsManager::copyToManaged(*_decoder.decodeNextFrame(), _drawSurface, _videoFormat == 1);
GraphicsManager::copyToManaged(*_decoder.decodeNextFrame(), _drawSurface, _videoFormat == kSmallVideoFormat);
_needsRedraw = true;
}

View File

@ -96,7 +96,7 @@ public:
Common::String _videoName;
Common::String _paletteName;
uint _videoFormat = 2;
uint _videoFormat = kLargeVideoFormat;
Common::String _text;
SoundDescription _sound;

View File

@ -103,7 +103,7 @@ void PlaySecondaryVideo::updateGraphics() {
if (_decoder.isPlaying()) {
if (_decoder.needsUpdate()) {
GraphicsManager::copyToManaged(*_decoder.decodeNextFrame(), _fullFrame, _paletteFilename.size() > 0);
GraphicsManager::copyToManaged(*_decoder.decodeNextFrame(), _fullFrame, _paletteFilename.size(), _videoFormat == kSmallVideoFormat);
_needsRedraw = true;
}
@ -165,7 +165,10 @@ void PlaySecondaryVideo::readData(Common::SeekableReadStream &stream) {
readFilename(stream, _paletteFilename);
ser.skip(10); // video overlay bitmap filename
ser.skip(12, kGameTypeVampire, kGameTypeVampire);
ser.skip(2, kGameTypeVampire, kGameTypeVampire);
ser.syncAsUint16LE(_videoFormat, kGameTypeVampire, kGameTypeVampire);
ser.skip(8, kGameTypeVampire, kGameTypeVampire);
ser.syncAsUint16LE(_videoHotspots, kGameTypeVampire, kGameTypeVampire);
ser.syncAsUint16LE(_loopFirstFrame);

View File

@ -55,6 +55,7 @@ public:
// Common::String _bitmapOverlayFilename
// TVD only
uint16 _videoFormat = kLargeVideoFormat;
uint16 _videoHotspots = kVideoHotspots;
uint16 _loopFirstFrame = 0; // 0x1E

View File

@ -76,9 +76,13 @@ static const byte kAbsoluteClockBump = 1;
static const byte kRelativeClockBump = 2;
// Time of day
static const byte kPlayerDay = 0;
static const byte kPlayerNight = 1;
static const byte kPlayerDuskDawn = 2;
static const byte kPlayerDay = 0;
static const byte kPlayerNight = 1;
static const byte kPlayerDuskDawn = 2;
// Video
static const byte kSmallVideoFormat = 1;
static const byte kLargeVideoFormat = 2;
enum MovementDirection : byte { kUp = 1, kDown = 2, kLeft = 4, kRight = 8, kMoveFast = 16 };

View File

@ -595,18 +595,18 @@ void Scene::load() {
_viewport.disableEdges(kLeft | kRight);
}
if (_sceneState.summary.videoFormat == 1) {
if (_sceneState.summary.videoFormat == kSmallVideoFormat) {
// TODO
} else if (_sceneState.summary.videoFormat == 2) {
} else if (_sceneState.summary.videoFormat == kLargeVideoFormat) {
// always start from the bottom
_sceneState.currentScene.verticalOffset = _viewport.getMaxScroll();
} else {
error("Unrecognized Scene summary chunk video file format");
}
if (_sceneState.summary.videoFormat == 1) {
if (_sceneState.summary.videoFormat == kSmallVideoFormat) {
// TODO
} else if (_sceneState.summary.videoFormat == 2) {
} else if (_sceneState.summary.videoFormat == kLargeVideoFormat) {
if (_viewport.getMaxScroll() == 0) {
_viewport.disableEdges(kUp | kDown);
}

View File

@ -213,7 +213,7 @@ void Viewport::setFrame(uint frameNr) {
// Format 1 uses quarter-size images, while format 2 uses full-size ones
// Videos in TVD are always upside-down
GraphicsManager::copyToManaged(*newFrame, _fullFrame, g_nancy->getGameType() == kGameTypeVampire, _videoFormat == 1);
GraphicsManager::copyToManaged(*newFrame, _fullFrame, g_nancy->getGameType() == kGameTypeVampire, _videoFormat == kSmallVideoFormat);
_needsRedraw = true;
_currentFrame = frameNr;

View File

@ -49,7 +49,7 @@ public:
_movementLastFrame(0),
_edgesMask(0),
_currentFrame(0),
_videoFormat(0),
_videoFormat(kLargeVideoFormat),
_stickyCursorPos(-1, -1),
_panningType(kPanNone) {}