mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-20 19:21:46 +00:00
TWINE: show dotemu splash screen
This commit is contained in:
parent
0e4169fdd3
commit
5fc73620a4
@ -21,10 +21,13 @@
|
||||
|
||||
#include "twine/renderer/screens.h"
|
||||
#include "common/file.h"
|
||||
#include "common/str.h"
|
||||
#include "common/system.h"
|
||||
#include "graphics/managed_surface.h"
|
||||
#include "graphics/surface.h"
|
||||
#include "image/bmp.h"
|
||||
#include "image/image_decoder.h"
|
||||
#include "image/png.h"
|
||||
#include "twine/audio/music.h"
|
||||
#include "twine/resources/hqr.h"
|
||||
#include "twine/resources/resources.h"
|
||||
@ -99,30 +102,58 @@ bool Screens::loadImageDelay(TwineImage image, int32 seconds) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Screens::loadBitmapDelay(const char *image, int32 seconds) {
|
||||
template<class ImageDecoder>
|
||||
static bool loadImageDelayViaDecoder(TwinEEngine *engine, const Common::String &fileName, int32 seconds) {
|
||||
ImageDecoder decoder;
|
||||
Common::File fileHandle;
|
||||
if (!fileHandle.open(image)) {
|
||||
warning("Failed to open %s", image);
|
||||
if (!fileHandle.open(fileName)) {
|
||||
warning("Failed to open %s", fileName.c_str());
|
||||
return false;
|
||||
}
|
||||
if (!decoder.loadStream(fileHandle)) {
|
||||
warning("Failed to load %s", fileName.c_str());
|
||||
return false;
|
||||
}
|
||||
const Graphics::Surface *src = decoder.getSurface();
|
||||
if (src == nullptr) {
|
||||
warning("Failed to decode %s", fileName.c_str());
|
||||
return false;
|
||||
}
|
||||
Graphics::ManagedSurface &target = engine->_frontVideoBuffer;
|
||||
Common::Rect rect(src->w, src->h);
|
||||
engine->setPalette(decoder.getPaletteStartIndex(), decoder.getPaletteColorCount(), decoder.getPalette());
|
||||
target.transBlitFrom(*src, rect, target.getBounds(), 0, false, 0, 0xff, nullptr, true);
|
||||
if (engine->delaySkip(1000 * seconds)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Screens::loadBitmapDelay(const char *image, int32 seconds) {
|
||||
Common::String filename(image);
|
||||
size_t extPos = filename.rfind(".");
|
||||
if (extPos == Common::String::npos) {
|
||||
warning("Failed to extract extension %s", image);
|
||||
return false;
|
||||
}
|
||||
|
||||
Image::BitmapDecoder bitmap;
|
||||
if (!bitmap.loadStream(fileHandle)) {
|
||||
warning("Failed to load %s", image);
|
||||
return false;
|
||||
}
|
||||
const Graphics::Surface *src = bitmap.getSurface();
|
||||
if (src == nullptr) {
|
||||
warning("Failed to decode %s", image);
|
||||
return false;
|
||||
}
|
||||
Graphics::ManagedSurface &target = _engine->_frontVideoBuffer;
|
||||
Common::Rect rect(src->w, src->h);
|
||||
_engine->setPalette(bitmap.getPaletteStartIndex(), bitmap.getPaletteColorCount(), bitmap.getPalette());
|
||||
target.transBlitFrom(*src, rect, target.getBounds(), 0, false, 0, 0xff, nullptr, true);
|
||||
if (_engine->delaySkip(1000 * seconds)) {
|
||||
return true;
|
||||
struct ImageLoader {
|
||||
const char *extension;
|
||||
bool (*loadImageDelay)(TwinEEngine *engine, const Common::String &fileName, int32 seconds);
|
||||
};
|
||||
|
||||
static const ImageLoader s_imageLoaders[] = {
|
||||
{ "bmp", loadImageDelayViaDecoder<Image::BitmapDecoder> },
|
||||
{ "png", loadImageDelayViaDecoder<Image::PNGDecoder> },
|
||||
{ nullptr, nullptr }
|
||||
};
|
||||
const Common::String &ext = filename.substr(extPos + 1);
|
||||
for (const ImageLoader *loader = s_imageLoaders; loader->extension; ++loader) {
|
||||
if (!scumm_stricmp(loader->extension, ext.c_str())) {
|
||||
return loader->loadImageDelay(_engine, filename, seconds);
|
||||
}
|
||||
}
|
||||
warning("Failed to find suitable image handler %s", image);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -548,6 +548,9 @@ void TwinEEngine::playIntro() {
|
||||
abort |= _screens->loadBitmapDelay("TLBA1C_640_480_256.bmp", 3);
|
||||
}
|
||||
} else {
|
||||
if (isDotEmuEnhanced()) {
|
||||
abort |= _screens->loadBitmapDelay("splash_1.png", 3);
|
||||
}
|
||||
abort |= _screens->adelineLogo();
|
||||
|
||||
if (isLBA1()) {
|
||||
@ -555,14 +558,14 @@ void TwinEEngine::playIntro() {
|
||||
if (!abort && _cfgfile.Version == EUROPE_VERSION) {
|
||||
// Little Big Adventure screen
|
||||
abort |= _screens->loadImageDelay(_resources->lbaLogo(), 3);
|
||||
if (!abort) {
|
||||
if (!abort && !isDotEmuEnhanced()) {
|
||||
// Electronic Arts Logo
|
||||
abort |= _screens->loadImageDelay(_resources->eaLogo(), 2);
|
||||
}
|
||||
} else if (!abort && _cfgfile.Version == USA_VERSION) {
|
||||
// Relentless screen
|
||||
abort |= _screens->loadImageDelay(_resources->relentLogo(), 3);
|
||||
if (!abort) {
|
||||
if (!abort && !isDotEmuEnhanced()) {
|
||||
// Electronic Arts Logo
|
||||
abort |= _screens->loadImageDelay(_resources->eaLogo(), 2);
|
||||
}
|
||||
|
@ -56,6 +56,7 @@ namespace Image {
|
||||
* - Hugo
|
||||
* - Mohawk
|
||||
* - Petka
|
||||
* - TwinE
|
||||
* - Wintermute
|
||||
* - Ultima8
|
||||
* @{
|
||||
|
@ -48,6 +48,7 @@ namespace Image {
|
||||
*
|
||||
* Used in engines:
|
||||
* - Sword25
|
||||
* - TwinE
|
||||
* - Wintermute
|
||||
* @{
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user