[Scummvm-git-logs] scummvm master -> 4ab52ae7c11cf46d8979993280733b12f028c69d
aquadran
aquadran at gmail.com
Sat Mar 6 21:05:26 UTC 2021
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
4ab52ae7c1 ICB: Fixed drawing slideshows from Extras
Commit: 4ab52ae7c11cf46d8979993280733b12f028c69d
https://github.com/scummvm/scummvm/commit/4ab52ae7c11cf46d8979993280733b12f028c69d
Author: PaweÅ KoÅodziejski (aquadran at gmail.com)
Date: 2021-03-06T22:05:21+01:00
Commit Message:
ICB: Fixed drawing slideshows from Extras
Changed paths:
R engines/icb/bink_stub.cpp
R engines/icb/bink_stub.h
engines/icb/module.mk
engines/icb/movie_pc.h
engines/icb/options_manager_pc.cpp
engines/icb/surface_manager.cpp
diff --git a/engines/icb/bink_stub.cpp b/engines/icb/bink_stub.cpp
deleted file mode 100644
index 89f8cb9ce3..0000000000
--- a/engines/icb/bink_stub.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-/* ResidualVM - A 3D game interpreter
- *
- * ResidualVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the AUTHORS
- * file distributed with this source distribution.
- *
- * Additional copyright for this file:
- * Copyright (C) 1999-2000 Revolution Software Ltd.
- * This code is based on source code created by Revolution Software,
- * used with permission.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "engines/icb/bink_stub.h"
-
-#include "common/textconsole.h"
-
-namespace ICB {
-
-HBINK BinkOpen(const char * /*name*/, uint32 /*flags*/) {
- warning("STUB: BinkOpen");
- return new BINK();
-}
-
-void BinkClose(HBINK handle) {
- warning("STUB: BinkClose");
-
- if (handle) {
- delete handle;
- }
-}
-
-const char *BinkGetError() {
- warning("STUB: BinkGetError");
- return "BinkGetError() stub";
-}
-
-int32 BinkWait(HBINK /*handle*/) {
- // STUB_FUNC();
- return 0;
-}
-
-void BinkService(HBINK /*handle*/) {
- // STUB_FUNC();
-}
-
-int32 BinkDoFrame(HBINK /*handle*/) {
- // STUB_FUNC();
- return 0;
-}
-
-void BinkNextFrame(HBINK /*handle*/) {
- // STUB_FUNC();
-}
-
-int32 BinkCopyToBuffer(HBINK /*handle*/, void *dst, int32 dstPitch, uint32 dstHeight, uint32 /*dstX*/, uint32 /*dstY*/, uint32 /*flags*/) {
- // STUB_FUNC();
- memset(dst, 0, dstPitch * dstHeight);
- return 0;
-}
-
-void BinkGoto(HBINK /*handle*/, uint32 /*frame*/, int32 /*flags*/) {
- // STUB_FUNC();
-}
-
-void BinkSoundUseDirectSound(uint32 /*flags*/) {
- warning("STUB: BinkSoundUseDirectSound");
-}
-
-void BinkSetVolume(HBINK /*handle*/, int /*volume*/) {
- warning("STUB: BinkSetVolume");
-}
-
-} // End of namespace ICB
diff --git a/engines/icb/bink_stub.h b/engines/icb/bink_stub.h
deleted file mode 100644
index e79f354033..0000000000
--- a/engines/icb/bink_stub.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* ResidualVM - A 3D game interpreter
- *
- * ResidualVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the AUTHORS
- * file distributed with this source distribution.
- *
- * Additional copyright for this file:
- * Copyright (C) 1999-2000 Revolution Software Ltd.
- * This code is based on source code created by Revolution Software,
- * used with permission.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef ICB_BINK_STUB_H
-#define ICB_BINK_STUB_H
-
-#include "engines/icb/common/px_rcutypes.h"
-
-namespace ICB {
-
-#define BINKSURFACE24 0
-#define BINKSURFACE32 0
-#define BINKFROMMEMORY 0
-#define BINKNOSKIP 0
-
-struct BINK {
- uint32 Width;
- uint32 Height;
- uint32 Frames;
- uint32 FrameNum;
- uint32 LastFrameNum;
-
- BINK() {
- Width = 640;
- Height = 480;
- Frames = 1;
- FrameNum = 1;
- LastFrameNum = 1;
- }
-};
-
-typedef BINK *HBINK;
-
-HBINK BinkOpen(const char *name, uint32 flags);
-void BinkClose(HBINK handle);
-
-const char *BinkGetError();
-
-int32 BinkWait(HBINK handle);
-void BinkService(HBINK handle);
-
-int32 BinkDoFrame(HBINK handle);
-void BinkNextFrame(HBINK handle);
-
-int32 BinkCopyToBuffer(HBINK handle, void *dst, int32 dstPitch, uint32 dstHeight, uint32 dstX, uint32 dstY, uint32 flags);
-void BinkGoto(HBINK handle, uint32 frame, int32 flags);
-
-void BinkSoundUseDirectSound(uint32 flags);
-void BinkSetVolume(HBINK handle, int volume);
-
-} // End of namespace ICB
-
-#endif // BINK_STUB_H
diff --git a/engines/icb/module.mk b/engines/icb/module.mk
index 383048b031..eff2622c95 100644
--- a/engines/icb/module.mk
+++ b/engines/icb/module.mk
@@ -9,7 +9,6 @@ MODULE_OBJS := \
animation_mega_set.o \
async_generic.o \
barriers.o \
- bink_stub.o \
bone.o \
breath.o \
camera.o \
diff --git a/engines/icb/movie_pc.h b/engines/icb/movie_pc.h
index a9caa6c6a7..1b60ce650a 100644
--- a/engines/icb/movie_pc.h
+++ b/engines/icb/movie_pc.h
@@ -28,7 +28,6 @@
#ifndef ICB_MOVIE_PC_H__
#define ICB_MOVIE_PC_H__
-#include "engines/icb/bink_stub.h"
#include "engines/icb/global_objects_pc.h"
#include "engines/icb/sound/direct_sound.h"
#include "engines/icb/sound.h"
diff --git a/engines/icb/options_manager_pc.cpp b/engines/icb/options_manager_pc.cpp
index 8963b8470e..9a2b1c74ac 100644
--- a/engines/icb/options_manager_pc.cpp
+++ b/engines/icb/options_manager_pc.cpp
@@ -44,6 +44,7 @@
#include "common/events.h"
#include "common/textconsole.h"
#include "common/file.h"
+#include "common/memstream.h"
namespace ICB {
@@ -6843,52 +6844,60 @@ void OptionsManager::DrawSlideShow() {
sprintf(art2DCluster, ICON_CLUSTER_PATH);
uint8 *slideptr = rs1->Res_open(slideFile, slideFileHash, art2DCluster, art2DClusterHash);
+ uint32 slideLen = rs_bg->Fetch_size(slideFile, slideFileHash, art2DCluster, art2DClusterHash);
// This slide is bink compressed
- HBINK binkHandle = BinkOpen((const char *)slideptr, BINKFROMMEMORY | BINKNOSKIP);
+ Video::BinkDecoder *binkDecoder = new Video::BinkDecoder();
+ binkDecoder->setDefaultHighColorFormat(Graphics::PixelFormat(4, 8, 8, 8, 0, 16, 8, 0, 24));
- if (binkHandle == NULL)
- Fatal_error("BinkOpen Failed with %s", BinkGetError());
+ Common::MemoryReadStream *stream = new Common::MemoryReadStream((byte *)slideptr, slideLen);
+ if (!stream) {
+ Fatal_error("Failed open bink file");
+ }
+ if (!binkDecoder->loadStream(stream)) {
+ Fatal_error("Failed open bink file");
+ }
// Verify image dimensions
- if (binkHandle->Width > SCREEN_WIDTH || binkHandle->Height > SCREEN_DEPTH)
+ if (binkDecoder->getWidth() > SCREEN_WIDTH || binkDecoder->getHeight() > SCREEN_DEPTH)
Fatal_error("Slide image is too large to fit screen!");
// Let bink do it stuff
- BinkDoFrame(binkHandle);
+ const Graphics::Surface *surfaceBink = binkDecoder->decodeNextFrame();
+ if (!surfaceBink)
+ Fatal_error("Filaed get slide image!");
// Lock the buffers now so bink has somewhere ot put it's data
- void *surface = (void *)surface_manager->Lock_surface(m_mySlotSurface1ID);
- uint32 pitch = surface_manager->Get_pitch(m_mySlotSurface1ID);
-
- // Go Bink go ...
- uint32 binkFlags = BINKNOSKIP;
- if (surface_manager->Get_BytesPP(m_mySlotSurface1ID) == 3) {
- binkFlags |= BINKSURFACE24;
- } else if (surface_manager->Get_BytesPP(m_mySlotSurface1ID) == 4) {
- binkFlags |= BINKSURFACE32;
- }
+ uint8 *surface = (uint8 *)surface_manager->Lock_surface(m_mySlotSurface1ID);
+ uint16 pitch = surface_manager->Get_pitch(m_mySlotSurface1ID);
+ uint32 height = surface_manager->Get_height(m_mySlotSurface1ID);
// Screen coordinates
uint32 m_x = 0;
uint32 m_y = 0;
// Centre of the screen please
- if (binkHandle->Width != SCREEN_WIDTH) {
- m_x = (SCREEN_WIDTH / 2) - (binkHandle->Width / 2);
+ if (binkDecoder->getWidth() != SCREEN_WIDTH) {
+ m_x = (SCREEN_WIDTH / 2) - (binkDecoder->getWidth() / 2);
}
- if (binkHandle->Height != SCREEN_DEPTH) {
- m_y = (SCREEN_DEPTH / 2) - (binkHandle->Height / 2);
+ if (binkDecoder->getHeight() != SCREEN_DEPTH) {
+ m_y = (SCREEN_DEPTH / 2) - (binkDecoder->getHeight() / 2);
}
- BinkCopyToBuffer(binkHandle, surface, pitch, SCREEN_DEPTH, m_x, m_y, binkFlags);
+ for (int i = 0; i < surfaceBink->h; i++) {
+ if (i + m_y >= height) {
+ break;
+ }
+ memcpy(surface + (m_x * 4) + (i + m_y) * pitch, surfaceBink->getBasePtr(0, i), MIN(surfaceBink->pitch, pitch));
+ }
// Get the first pixel colour
m_slideFillColour = *((int32 *)surface + m_x + (m_y * pitch));
surface_manager->Unlock_surface(m_mySlotSurface1ID);
- BinkClose(binkHandle);
+ binkDecoder->close();
+ delete binkDecoder;
// Update the screen
surface_manager->Blit_surface_to_surface(m_mySlotSurface1ID, working_buffer_id, NULL, NULL, 0);
diff --git a/engines/icb/surface_manager.cpp b/engines/icb/surface_manager.cpp
index c9f94975af..77b2a40611 100644
--- a/engines/icb/surface_manager.cpp
+++ b/engines/icb/surface_manager.cpp
@@ -407,7 +407,6 @@ void _surface_manager::Blit_surface_to_surface(uint32 from_id, uint32 to_id, LRE
m_Surfaces[from_id]->m_colorKeyEnable = false;
}
- // TODO: Check that the sizes match.
if (pDestRect) {
if (pSrcRect) {
copyRectToSurface(dstSurface, srcSurface, dstRect.left, dstRect.top, srcRect,
@@ -418,8 +417,15 @@ void _surface_manager::Blit_surface_to_surface(uint32 from_id, uint32 to_id, LRE
}
} else {
if (pSrcRect) {
- copyRectToSurface(dstSurface, srcSurface, 0, 0, srcRect,
+ uint16 dstX = dstSurface->w - srcRect.right;
+ copyRectToSurface(dstSurface, srcSurface, dstX, 0, srcRect,
m_Surfaces[from_id]->m_colorKeyEnable, m_Surfaces[from_id]->m_colorKey);
+ if (dstX != 0) {
+ dstSurface->fillRect(Common::Rect(0, 0, dstX - 1, dstSurface->h), 0);
+ } else {
+ dstSurface->fillRect(Common::Rect(dstX + (dstSurface->w - srcRect.left), 0,
+ dstSurface->w, dstSurface->h), 0);
+ }
} else {
copyRectToSurface(dstSurface, srcSurface, 0, 0, Common::Rect(0, 0, srcSurface->w, srcSurface->h),
m_Surfaces[from_id]->m_colorKeyEnable, m_Surfaces[from_id]->m_colorKey);
More information about the Scummvm-git-logs
mailing list