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