LURE: Add MT-32 initialization icon blinking

This commit is contained in:
NMIError 2020-08-10 12:09:47 +02:00 committed by Thierry Crozat
parent 89e6ffc2e6
commit 81c514ac8f
3 changed files with 22 additions and 3 deletions

View File

@ -166,6 +166,7 @@ bool SoundManager::initCustomTimbres(bool canAbort) {
AudioInitIcon *icon = new AudioInitIcon();
icon->show();
uint32 iconTime = g_system->getMillis();
// Send SysExes
@ -215,7 +216,7 @@ bool SoundManager::initCustomTimbres(bool canAbort) {
while (!_mt32Driver->isReady()) {
Events &events = Events::getReference();
if (events.interruptableDelay(100)) {
if (events.interruptableDelay(10)) {
if (LureEngine::getReference().shouldQuit() ||
(canAbort && events.type() == Common::EVENT_KEYDOWN && events.event().kbd.keycode == 27)) {
// User has quit the game or pressed Escape.
@ -224,6 +225,12 @@ bool SoundManager::initCustomTimbres(bool canAbort) {
break;
}
}
// Blink the audio initialization icon every 500 ms
if (g_system->getMillis() > iconTime + 500) {
icon->toggleVisibility();
iconTime = g_system->getMillis();
}
}
icon->hide();

View File

@ -1435,7 +1435,7 @@ void CopyProtectionDialog::chooseCharacters() {
screen.update();
}
AudioInitIcon::AudioInitIcon() {
AudioInitIcon::AudioInitIcon() : _visible(false) {
if (LureEngine::getReference().isEGA()) {
// The icon is not shown on EGA
_iconSurface = 0;
@ -1460,12 +1460,12 @@ AudioInitIcon::~AudioInitIcon() {
}
void AudioInitIcon::show() {
// TODO The icon should blink
if (!LureEngine::getReference().isEGA()) {
Screen &screen = Screen::getReference();
_iconSurface->copyTo(&screen.screen(), 0, 185);
screen.update();
_visible = true;
}
}
@ -1475,6 +1475,15 @@ void AudioInitIcon::hide() {
screen.screen().fillRect(Common::Rect(0, 185, 14, 199), 0);
screen.update();
_visible = false;
}
}
void AudioInitIcon::toggleVisibility() {
if (_visible) {
hide();
} else {
show();
}
}

View File

@ -148,10 +148,13 @@ public:
class AudioInitIcon {
private:
Surface *_iconSurface;
bool _visible;
public:
AudioInitIcon();
~AudioInitIcon();
void toggleVisibility();
void show();
void hide();
};