TWINE: one abort action to cancel the whole intro loop

This commit is contained in:
Martin Gerhardy 2020-10-27 17:53:46 +01:00
parent ef9fc9f64a
commit d583ad076a
4 changed files with 39 additions and 25 deletions

View File

@ -30,11 +30,14 @@
namespace TwinE {
void Screens::adelineLogo() {
bool Screens::adelineLogo() {
_engine->_music->playMidiMusic(31);
loadImageDelay(RESSHQR_ADELINEIMG, 7);
if (loadImageDelay(RESSHQR_ADELINEIMG, 7)) {
return true;
}
palCustom = true;
return false;
}
void Screens::loadMenuImage(bool fade_in) {
@ -88,10 +91,14 @@ void Screens::loadImage(int32 index, bool fade_in) {
palCustom = true;
}
void Screens::loadImageDelay(int32 index, int32 time) {
bool Screens::loadImageDelay(int32 index, int32 seconds) {
loadImage(index);
_engine->delaySkip(1000 * time);
if (_engine->delaySkip(1000 * seconds)) {
adjustPalette(0, 0, 0, paletteRGBACustom, 100);
return true;
}
fadeOut(paletteRGBACustom);
return false;
}
void Screens::fadeIn(uint32 *pal) {

View File

@ -66,7 +66,7 @@ public:
uint32 mainPaletteRGBA[NUMOFCOLORS]{0};
/** Load and display Adeline Logo */
void adelineLogo();
bool adelineLogo();
void convertPalToRGBA(const uint8 *in, uint32 *out);
@ -89,9 +89,9 @@ public:
/**
* Load and display a particulary image on \a RESS.HQR file with cross fade effect and delay
* @param index \a RESS.HQR entry index (starting from 0)
* @param time number of seconds to delay
* @param seconds number of seconds to delay
*/
void loadImageDelay(int32 index, int32 time);
bool loadImageDelay(int32 index, int32 seconds);
/**
* Fade image in

View File

@ -299,28 +299,34 @@ void TwinEEngine::initEngine() {
#if TWINE_PLAY_INTROS
_input->enableKeyMap(cutsceneKeyMapId);
// Display company logo
_screens->adelineLogo();
bool abort = false;
abort |= _screens->adelineLogo();
// verify game version screens
if (cfgfile.Version == EUROPE_VERSION) {
if (!abort && cfgfile.Version == EUROPE_VERSION) {
// Little Big Adventure screen
_screens->loadImageDelay(RESSHQR_LBAIMG, 3);
// Electronic Arts Logo
_screens->loadImageDelay(RESSHQR_EAIMG, 2);
} else if (cfgfile.Version == USA_VERSION) {
abort |= _screens->loadImageDelay(RESSHQR_LBAIMG, 3);
if (!abort) {
// Electronic Arts Logo
abort |= _screens->loadImageDelay(RESSHQR_EAIMG, 2);
}
} else if (!abort && cfgfile.Version == USA_VERSION) {
// Relentless screen
_screens->loadImageDelay(RESSHQR_RELLENTIMG, 3);
// Electronic Arts Logo
_screens->loadImageDelay(RESSHQR_EAIMG, 2);
} else if (cfgfile.Version == MODIFICATION_VERSION) {
abort |= _screens->loadImageDelay(RESSHQR_RELLENTIMG, 3);
if (!abort) {
// Electronic Arts Logo
abort |= _screens->loadImageDelay(RESSHQR_EAIMG, 2);
}
} else if (!abort && cfgfile.Version == MODIFICATION_VERSION) {
// Modification screen
_screens->loadImageDelay(RESSHQR_RELLENTIMG, 2);
abort |= _screens->loadImageDelay(RESSHQR_RELLENTIMG, 2);
}
_flaMovies->playFlaMovie(FLA_DRAGON3);
#else
_input->enableKeyMap(uiKeyMapId);
if (!abort) {
_flaMovies->playFlaMovie(FLA_DRAGON3);
}
#endif
_input->enableKeyMap(uiKeyMapId);
_screens->loadMenuImage();
}
@ -830,21 +836,22 @@ bool TwinEEngine::gameEngineLoop() { // mainLoop
return false;
}
void TwinEEngine::delaySkip(uint32 time) {
bool TwinEEngine::delaySkip(uint32 time) {
uint32 startTicks = _system->getMillis();
uint32 stopTicks = 0;
do {
readKeys();
if (_input->toggleAbortAction()) {
break;
return true;
}
if (shouldQuit()) {
break;
return true;
}
stopTicks = _system->getMillis() - startTicks;
_system->delayMillis(1);
//lbaTime++;
} while (stopTicks <= time);
return false;
}
void TwinEEngine::setPalette(const uint32 *palette) {

View File

@ -269,7 +269,7 @@ public:
* Deplay certain seconds till proceed - Can also Skip this delay
* @param time time in seconds to delay
*/
void delaySkip(uint32 time);
bool delaySkip(uint32 time);
/**
* Set a new palette in the SDL screen buffer