NANCY: Fix console commands

Fixed the play_video and show_image console commands, which were using the wrong pixel format and drawing broken colors.
This commit is contained in:
fracturehill 2021-04-01 01:01:05 +03:00
parent 57cd69b9c0
commit 97b4ef1301
3 changed files with 10 additions and 6 deletions

View File

@ -63,7 +63,6 @@ void NancyConsole::postEnter() {
if (dec->loadFile(_videoFile)) {
dec->start();
g_system->fillScreen(0);
Common::EventManager *ev = g_system->getEventManager();
while (!g_nancy->shouldQuit() && !dec->endOfVideo()) {
Common::Event event;
@ -76,8 +75,7 @@ void NancyConsole::postEnter() {
if (dec->needsUpdate()) {
const Graphics::Surface *frame = dec->decodeNextFrame();
if (frame) {
g_system->copyRectToScreen(frame->getPixels(), frame->pitch, 0, 0, frame->w, frame->h);
g_system->updateScreen();
g_nancy->_graphicsManager->debugDrawToScreen(*frame);
}
}
@ -96,9 +94,7 @@ void NancyConsole::postEnter() {
if (!_imageFile.empty()) {
Graphics::Surface surf;
if (g_nancy->_resource->loadImage(_imageFile, surf)) {
g_system->fillScreen(0);
g_system->copyRectToScreen(surf.getPixels(), surf.pitch, 0, 0, surf.w > 640 ? 640 : surf.w, surf.h > 480 ? 480 : surf.h);
g_system->updateScreen();
g_nancy->_graphicsManager->debugDrawToScreen(surf);
surf.free();
Common::EventManager *ev = g_system->getEventManager();

View File

@ -219,6 +219,11 @@ void GraphicsManager::copyToManaged(void *src, Graphics::ManagedSurface &dst, ui
copyToManaged(surf, dst, verticalFlip, doubleSize);
}
void GraphicsManager::debugDrawToScreen(const Graphics::Surface &surf) {
_screen.blitFrom(surf, Common::Point());
_screen.update();
}
const Graphics::PixelFormat &GraphicsManager::getInputPixelFormat() {
if (g_nancy->getGameFlags() & NGF_8BITCOLOR) {
return _clut8Format;

View File

@ -58,6 +58,9 @@ public:
static void copyToManaged(const Graphics::Surface &src, Graphics::ManagedSurface &dst, bool verticalFlip = false, bool doubleSize = false);
static void copyToManaged(void *src, Graphics::ManagedSurface &dst, uint srcW, uint srcH, const Graphics::PixelFormat &format, bool verticalFlip = false, bool doubleSize = false);
// Debug
void debugDrawToScreen(const Graphics::Surface &surf);
Graphics::ManagedSurface _object0;
Graphics::PixelFormat _screenPixelFormat;