From ac5d392a76eeb3e1d09bc4c585d6e29f5c9f47d8 Mon Sep 17 00:00:00 2001 From: Le Philousophe Date: Fri, 3 May 2019 00:01:35 +0200 Subject: CRYOMNI3D: Add a function to load a set of BMP files --- engines/cryomni3d/versailles/engine.cpp | 20 ++++++++++++++++++++ engines/cryomni3d/versailles/engine.h | 2 ++ 2 files changed, 22 insertions(+) (limited to 'engines/cryomni3d/versailles') diff --git a/engines/cryomni3d/versailles/engine.cpp b/engines/cryomni3d/versailles/engine.cpp index a227a2676d..608da9c1b5 100644 --- a/engines/cryomni3d/versailles/engine.cpp +++ b/engines/cryomni3d/versailles/engine.cpp @@ -1537,5 +1537,25 @@ void CryOmni3DEngine_Versailles::playInGameVideo(const Common::String &filename, g_system->showMouse(true); } +void CryOmni3DEngine_Versailles::loadBMPs(const char *pattern, Graphics::Surface *bmps, + unsigned int count) { + Image::BitmapDecoder bmpDecoder; + Common::File file; + + for (unsigned int i = 0; i < count; i++) { + Common::String bmp = Common::String::format(pattern, i); + + if (!file.open(bmp)) { + error("Failed to open BMP file: %s", bmp.c_str()); + } + if (!bmpDecoder.loadStream(file)) { + error("Failed to load BMP file: %s", bmp.c_str()); + } + bmps[i].copyFrom(*bmpDecoder.getSurface()); + bmpDecoder.destroy(); + file.close(); + } +} + } // End of namespace Versailles } // End of namespace CryOmni3D diff --git a/engines/cryomni3d/versailles/engine.h b/engines/cryomni3d/versailles/engine.h index 9d0b7acbd3..438ae16395 100644 --- a/engines/cryomni3d/versailles/engine.h +++ b/engines/cryomni3d/versailles/engine.h @@ -327,6 +327,8 @@ private: void playInGameVideo(const Common::String &filename, bool restoreCursorPalette = true); + void loadBMPs(const char *pattern, Graphics::Surface *bmps, unsigned int count); + unsigned int getMusicId(unsigned int level, unsigned int placeId) const; bool musicWouldChange(unsigned int level, unsigned int placeId) const; void musicUpdate(); -- cgit v1.2.3