diff options
author | Paul Gilbert | 2016-02-06 11:22:08 -0500 |
---|---|---|
committer | Paul Gilbert | 2016-02-06 11:22:08 -0500 |
commit | 0874af38dbad54551e143e541f37163ec9e7e0e7 (patch) | |
tree | 0cc11c7ecba9f7f4b7d3ddf98d9bca7a87786e83 /engines/titanic | |
parent | ab28f8714353ab5043d86375572815ebc75fe7ed (diff) | |
download | scummvm-rg350-0874af38dbad54551e143e541f37163ec9e7e0e7.tar.gz scummvm-rg350-0874af38dbad54551e143e541f37163ec9e7e0e7.tar.bz2 scummvm-rg350-0874af38dbad54551e143e541f37163ec9e7e0e7.zip |
TITANIC: Added Image::loadResource
Diffstat (limited to 'engines/titanic')
-rw-r--r-- | engines/titanic/image.cpp | 31 | ||||
-rw-r--r-- | engines/titanic/image.h | 6 |
2 files changed, 35 insertions, 2 deletions
diff --git a/engines/titanic/image.cpp b/engines/titanic/image.cpp index d49f2eca2d..b18d591d37 100644 --- a/engines/titanic/image.cpp +++ b/engines/titanic/image.cpp @@ -20,6 +20,7 @@ * */ +#include "common/file.h" #include "titanic/image.h" namespace Titanic { @@ -76,6 +77,22 @@ void Image::proc8() { } bool Image::loadResource(const Common::String &name) { + // This method is hardcoded for the Titanic splash screen resource + assert(name == "TITANIC"); + + Common::File f; + if (!f.open("ST.exe")) + return false; + + // The ST.exe executable has a bitmap called "TITANIC". Since we can't use + // the Windows FindResource function in ScummVM, this is hardcoded for now + f.seek(0x29B660); + uint size = f.readUint32LE(); + if (size != 40) + return false; + + loadBitmap(f); + return true; } @@ -87,4 +104,18 @@ void Image::draw() { } +void Image::loadBitmap(Common::SeekableReadStream &s) { + _bitmapInfo->_bmiHeader._biWidth = s.readUint32LE(); + _bitmapInfo->_bmiHeader._biHeight = s.readUint32LE(); + _bitmapInfo->_bmiHeader._biPlanes = s.readUint16LE(); + _bitmapInfo->_bmiHeader._biBitCount = s.readUint16LE(); + _bitmapInfo->_bmiHeader._biCompression = s.readUint32LE(); + _bitmapInfo->_bmiHeader._biSizeImage = s.readUint32LE(); + _bitmapInfo->_bmiHeader._biXPelsPerMeter = s.readUint32LE(); + _bitmapInfo->_bmiHeader._biYPelsPerMeter = s.readUint32LE(); + _bitmapInfo->_bmiHeader._biClrUsed = s.readUint32LE(); + _bitmapInfo->_bmiHeader._biClrImportant = s.readUint32LE(); + +} + } // End of namespace Titanic diff --git a/engines/titanic/image.h b/engines/titanic/image.h index 625c78b01b..adef011df1 100644 --- a/engines/titanic/image.h +++ b/engines/titanic/image.h @@ -34,11 +34,11 @@ struct BITMAPINFOHEADER { int _biHeight; int _biPlanes; int _biBitCount; - bool _biCompression; + int _biCompression; int _biSizeImage; int _biXPelsPerMeter; int _biYPelsPerMeter; - int _biCirUsed; + int _biClrUsed; int _biClrImportant; BITMAPINFOHEADER(); @@ -59,6 +59,8 @@ struct tagBITMAPINFO { }; class Image { +private: + void loadBitmap(Common::SeekableReadStream &s); public: tagBITMAPINFO *_bitmapInfo; byte *_bits; |