[Scummvm-git-logs] scummvm master -> 3046bcb38c70c1642502437ff66258678cb643e7
alxpnv
a04198622 at gmail.com
Fri Aug 13 11:56:28 UTC 2021
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
68b204b9ef ASYLUM: add preliminary support for the Steam version
3046bcb38c ASYLUM: (VCR puzzle) fix transition to video
Commit: 68b204b9efb5726195eee649cf6bdb8a676cd200
https://github.com/scummvm/scummvm/commit/68b204b9efb5726195eee649cf6bdb8a676cd200
Author: alxpnv (alxpnv22 at yahoo.com)
Date: 2021-08-13T14:56:49+03:00
Commit Message:
ASYLUM: add preliminary support for the Steam version
Changed paths:
engines/asylum/asylum.h
engines/asylum/detection_tables.h
engines/asylum/views/video.cpp
engines/asylum/views/video.h
diff --git a/engines/asylum/asylum.h b/engines/asylum/asylum.h
index 06aa5c7fff..8e227855ae 100644
--- a/engines/asylum/asylum.h
+++ b/engines/asylum/asylum.h
@@ -29,6 +29,7 @@
#include "common/serializer.h"
#include "common/system.h"
+#include "engines/advancedDetector.h"
#include "engines/engine.h"
#include "asylum/resources/data.h"
@@ -191,6 +192,8 @@ public:
// Serializable
void saveLoadWithSerializer(Common::Serializer &s);
+ bool checkGameVersion(const char *version) { return !strcmp(_gameDescription->extra, version); }
+
private:
const ADGameDescription *_gameDescription;
diff --git a/engines/asylum/detection_tables.h b/engines/asylum/detection_tables.h
index d5e0b02af7..9c9e6804f6 100644
--- a/engines/asylum/detection_tables.h
+++ b/engines/asylum/detection_tables.h
@@ -88,6 +88,21 @@ static const ADGameDescription gameDescriptions[] = {
ADGF_UNSTABLE | ADGF_DROPPLATFORM,
GUIO0()
},
+ {
+ "asylum",
+ "Steam",
+ {
+ {"SNTRM.DAT", 0, "7cfcc457c1f579fbf9878ac175d29374", 8930},
+ {"RES.000", 0, "f58f8dc3e63663f174977d359e11132c", 272057},
+ {"SCN.006", 0, "3a5b54da08198012dc0614114782d5fb", 2918330},
+ {"MOV000_2_SMK.ogv", 0, NULL, -1},
+ AD_LISTEND
+ },
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE | ADGF_DROPPLATFORM,
+ GUIO0()
+ },
{
"asylum",
"French Version",
diff --git a/engines/asylum/views/video.cpp b/engines/asylum/views/video.cpp
index c363b34e9f..d41962d82f 100644
--- a/engines/asylum/views/video.cpp
+++ b/engines/asylum/views/video.cpp
@@ -20,6 +20,9 @@
*
*/
+#include "video/smk_decoder.h"
+#include "video/theora_decoder.h"
+
#include "asylum/views/video.h"
#include "asylum/system/config.h"
@@ -38,11 +41,27 @@ namespace Asylum {
VideoPlayer::VideoPlayer(AsylumEngine *engine, Audio::Mixer *mixer) : _vm(engine),
_currentMovie(0), _subtitleIndex(0), _subtitleCounter(0), _previousFont(kResourceNone), _done(false) {
- _smkDecoder = new Video::SmackerDecoder();
+
+ memset(_subtitlePalette, 0, sizeof(_subtitlePalette));
+ if (_vm->checkGameVersion("Steam")) {
+#ifdef USE_THEORADEC
+ _decoder = new Video::TheoraDecoder();
+ _decoder->setDefaultHighColorFormat(_vm->_system->getOverlayFormat());
+
+ Common::File paletteFile;
+ paletteFile.open("palette");
+ paletteFile.read(_subtitlePalette, PALETTE_SIZE);
+ paletteFile.close();
+#else
+ error("The Steam version of the game uses Theora videos but ScummVM has been compiled without Theora support");
+#endif
+ } else {
+ _decoder = new Video::SmackerDecoder();
+ }
}
VideoPlayer::~VideoPlayer() {
- delete _smkDecoder;
+ delete _decoder;
}
//////////////////////////////////////////////////////////////////////////
@@ -84,6 +103,13 @@ bool VideoPlayer::handleEvent(const AsylumEvent &evt) {
char *text = getText()->get(_subtitles[_subtitleIndex].resourceId);
getText()->draw(0, 99, kTextCenter, Common::Point(10, y), 20, 620, text);
+
+ if (_vm->checkGameVersion("Steam")) {
+ Graphics::Surface *st = getScreen()->getSurface()->convertTo(_vm->_system->getOverlayFormat(), _subtitlePalette);
+ _vm->_system->copyRectToOverlay((const byte *)st->getBasePtr(0, 400), st->pitch, 0, 400, 640, 80);
+ st->free();
+ delete st;
+ }
}
--_subtitleCounter;
@@ -119,7 +145,13 @@ void VideoPlayer::play(uint32 videoNumber, EventHandler *handler) {
// Play movie
_vm->switchEventHandler(this);
- play(Common::String::format("mov%03d.smk", videoNumber), Config.showMovieSubtitles);
+
+ Common::String filename;
+ if (_vm->checkGameVersion("Steam"))
+ filename = videoNumber == 0 ? "mov000_2_smk.ogv" : Common::String::format("mov%03d_smk.ogv", videoNumber);
+ else
+ filename = Common::String::format("mov%03d.smk", videoNumber);
+ play(filename, Config.showMovieSubtitles);
// Cleanup and switch to previous event handler
getCursor()->show();
@@ -128,11 +160,11 @@ void VideoPlayer::play(uint32 videoNumber, EventHandler *handler) {
}
void VideoPlayer::play(Common::String filename, bool showSubtitles) {
- if (!_smkDecoder->loadFile(filename))
+ if (!_decoder->loadFile(filename))
error("[Video::playVideo] Invalid video index (%d)", _currentMovie);
- int16 x = (int16)Common::Rational(g_system->getWidth() - _smkDecoder->getWidth(), 2).toInt();
- int16 y = (int16)Common::Rational(g_system->getHeight() - _smkDecoder->getHeight(), 2).toInt();
+ int16 x = (int16)Common::Rational(g_system->getWidth() - _decoder->getWidth(), 2).toInt();
+ int16 y = (int16)Common::Rational(g_system->getHeight() - _decoder->getHeight(), 2).toInt();
getScreen()->clear();
@@ -149,24 +181,31 @@ void VideoPlayer::play(Common::String filename, bool showSubtitles) {
int32 frameEnd = 0;
int32 currentSubtitle = 0;
- _smkDecoder->start();
+ _decoder->start();
+ if (_vm->checkGameVersion("Steam")) {
+ _vm->_system->showOverlay();
+ _vm->_system->clearOverlay();
+ }
- while (!_done && !Engine::shouldQuit() && !_smkDecoder->endOfVideo()) {
+ while (!_done && !Engine::shouldQuit() && !_decoder->endOfVideo()) {
_vm->handleEvents();
- if (_smkDecoder->needsUpdate()) {
- const Graphics::Surface *frame = _smkDecoder->decodeNextFrame();
+ if (_decoder->needsUpdate()) {
+ const Graphics::Surface *frame = _decoder->decodeNextFrame();
if (!frame)
continue;
- if (_smkDecoder->hasDirtyPalette())
- setupPalette();
-
- getScreen()->copyToBackBuffer((const byte *)frame->getPixels(), frame->pitch, x, y, frame->w, frame->h);
+ if (_vm->checkGameVersion("Steam")) {
+ _vm->_system->copyRectToOverlay((const byte *)frame->getPixels(), frame->pitch, x, y, frame->w, frame->h);
+ } else {
+ if (_decoder->hasDirtyPalette())
+ setupPalette();
+ getScreen()->copyToBackBuffer((const byte *)frame->getPixels(), frame->pitch, x, y, frame->w, frame->h);
+ }
if (showSubtitles) {
- int32 currentFrame = _smkDecoder->getCurFrame() + 1;
+ int32 currentFrame = _decoder->getCurFrame() + 1;
debugC(kDebugLevelVideo, "[Video] {%s} Playing Frame %d", filename.c_str(), currentFrame);
// Check for next frame
if (currentFrame > frameEnd) {
@@ -191,12 +230,15 @@ void VideoPlayer::play(Common::String filename, bool showSubtitles) {
g_system->delayMillis(10);
}
- _smkDecoder->close();
+ if (_vm->checkGameVersion("Steam"))
+ _vm->_system->hideOverlay();
+
+ _decoder->close();
_subtitles.clear();
}
void VideoPlayer::setupPalette() {
- getScreen()->setMainPalette(_smkDecoder->getPalette());
+ getScreen()->setMainPalette(_decoder->getPalette());
getScreen()->setupPalette(NULL, 0, 0);
}
diff --git a/engines/asylum/views/video.h b/engines/asylum/views/video.h
index 9ad5e513be..d933915bc6 100644
--- a/engines/asylum/views/video.h
+++ b/engines/asylum/views/video.h
@@ -32,11 +32,13 @@
#include "graphics/surface.h"
-#include "video/smk_decoder.h"
+#include "video/video_decoder.h"
#include "asylum/eventhandler.h"
#include "asylum/shared.h"
+#include "asylum/system/screen.h"
+
namespace Asylum {
class AsylumEngine;
@@ -75,7 +77,7 @@ public:
private:
AsylumEngine *_vm;
- Video::SmackerDecoder *_smkDecoder;
+ Video::VideoDecoder *_decoder;
Common::Array<VideoSubtitle> _subtitles;
int32 _currentMovie;
@@ -83,7 +85,7 @@ private:
int32 _subtitleCounter;
ResourceId _previousFont;
bool _done;
-
+ byte _subtitlePalette[PALETTE_SIZE];
/**
* Plays the given file.
Commit: 3046bcb38c70c1642502437ff66258678cb643e7
https://github.com/scummvm/scummvm/commit/3046bcb38c70c1642502437ff66258678cb643e7
Author: alxpnv (alxpnv22 at yahoo.com)
Date: 2021-08-13T14:56:50+03:00
Commit Message:
ASYLUM: (VCR puzzle) fix transition to video
Changed paths:
engines/asylum/puzzles/vcr.cpp
engines/asylum/system/screen.h
diff --git a/engines/asylum/puzzles/vcr.cpp b/engines/asylum/puzzles/vcr.cpp
index 30ea03d3c7..6b90b89a3b 100644
--- a/engines/asylum/puzzles/vcr.cpp
+++ b/engines/asylum/puzzles/vcr.cpp
@@ -326,8 +326,11 @@ void PuzzleVCR::updateScreen(const AsylumEvent &) {
getScreen()->draw(getWorld()->graphicResourceIds[0]);
getScreen()->drawGraphicsInQueue();
- for (int16 barSize = 0; barSize < 84; barSize += 4)
+ getScreen()->clearDefaultColor();
+ for (int16 barSize = 0; barSize < 84; barSize += 4) {
getScreen()->drawWideScreenBars(barSize);
+ _vm->_system->updateScreen();
+ }
// Palette fade
getScreen()->paletteFade(0, 25, 10);
diff --git a/engines/asylum/system/screen.h b/engines/asylum/system/screen.h
index 85ff8bcefb..cdc5752393 100644
--- a/engines/asylum/system/screen.h
+++ b/engines/asylum/system/screen.h
@@ -86,6 +86,7 @@ public:
// Misc
void clear();
+ void clearDefaultColor() { memset(_mainPalette, 0, 3); setupPalette(NULL, 0, 0); }
void drawWideScreenBars(int16 barSize) const;
void fillRect(int16 x, int16 y, int16 x2, int16 y2, uint32 color);
void copyBackBufferToScreen();
More information about the Scummvm-git-logs
mailing list