From 0dff818594a67982afbe499898a95937797c33aa Mon Sep 17 00:00:00 2001 From: uruk Date: Mon, 3 Mar 2014 21:11:07 +0100 Subject: AVALANCHE: Implement the status leds on the toolbar. --- engines/avalanche/avalot.cpp | 15 +++++++++++---- engines/avalanche/dialogs.cpp | 10 ++++++---- engines/avalanche/graphics.cpp | 22 +++++++++++++++++++++- engines/avalanche/graphics.h | 2 ++ engines/avalanche/sound.cpp | 1 + 5 files changed, 41 insertions(+), 9 deletions(-) (limited to 'engines') diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 2e89287f58..20e16a55b1 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -201,6 +201,8 @@ void AvalancheEngine::setup() { _menu->init(); + _graphics->drawSoundLight(_sound->_soundFl); + int16 loadSlot = ConfMan.instance().getInt("save_slot"); if (loadSlot >= 0) { _thinks = 2; // You always have money. @@ -210,8 +212,6 @@ void AvalancheEngine::setup() { } else { newGame(); - _soundFx = !_soundFx; - fxToggle(); thinkAbout(kObjectMoney, kThing); _dialogs->displayScrollChain('Q', 83); // Info on the game, etc. @@ -1155,7 +1155,7 @@ void AvalancheEngine::checkClick() { _animation->_sprites[0]->_speedX = kRun; _animation->updateSpeed(); } else if ((396 <= cursorPos.x) && (cursorPos.x <= 483)) - fxToggle(); + _sound->toggleSound(); else if ((535 <= cursorPos.x) && (cursorPos.x <= 640)) _mouseText.insertChar(kControlNewLine, 0); } else if (!_dropsOk) @@ -1164,7 +1164,14 @@ void AvalancheEngine::checkClick() { } void AvalancheEngine::errorLed() { - warning("STUB: errorled()"); + _dialogs->setReadyLight(0); + _graphics->drawErrorLight(true); + for (int i = 177; i >= 1; i--) { + _sound->playNote(177 + (i * 177177) / 999, 1); + _system->delayMillis(1); + } + _graphics->drawErrorLight(false); + _dialogs->setReadyLight(2); } /** diff --git a/engines/avalanche/dialogs.cpp b/engines/avalanche/dialogs.cpp index 36f6f4470c..dc1c277877 100644 --- a/engines/avalanche/dialogs.cpp +++ b/engines/avalanche/dialogs.cpp @@ -93,6 +93,7 @@ void Dialogs::setReadyLight(byte state) { if (_vm->_ledStatus == state) return; // Already like that! + // TODO: Implement different patterns for green color. Color color = kColorBlack; switch (state) { case 0: @@ -104,9 +105,7 @@ void Dialogs::setReadyLight(byte state) { color = kColorGreen; break; // Hit a key } - warning("STUB: Dialogs::setReadyLight()"); - - CursorMan.showMouse(false); + _vm->_graphics->drawReadyLight(color); CursorMan.showMouse(true); _vm->_ledStatus = state; @@ -175,7 +174,8 @@ void Dialogs::scrollModeNormal() { (event.kbd.keycode == Common::KEYCODE_PLUS)))) { escape = true; break; - } + } else if (event.type == Common::EVENT_KEYDOWN) + _vm->errorLed(); } } @@ -822,6 +822,8 @@ void Dialogs::displayText(Common::String text) { } } } + + setReadyLight(2); } void Dialogs::setTalkPos(int16 x, int16 y) { diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 9510f4f72a..11b149babd 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -992,7 +992,27 @@ void GraphicManager::drawCursor(byte pos) { } void GraphicManager::drawReadyLight(Color color) { - _surface.fillRect(Common::Rect(419, 195, 438, 197), color); + _surface.fillRect(Common::Rect(419, 195, 439, 198), color); + _scrolls.fillRect(Common::Rect(419, 195, 439, 198), color); +} + +void GraphicManager::drawSoundLight(bool state) { + Color color = kColorBlack; + if (state) + color = kColorCyan; + else + color = kColorBlack; + _surface.fillRect(Common::Rect(419, 175, 439, 178), color); +} + +void GraphicManager::drawErrorLight(bool state) { + Color color = kColorBlack; + if (state) + color = kColorRed; + else + color = kColorBlack; + _surface.fillRect(Common::Rect(419, 184, 439, 187), color); + refreshScreen(); } /** diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index acc0c92a15..579aa2e056 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -131,6 +131,8 @@ public: void drawToolbar(); void drawCursor(byte pos); void drawReadyLight(Color color); + void drawSoundLight(bool state); + void drawErrorLight(bool state); void drawSign(Common::String name, int16 xl, int16 yl, int16 y); void drawIcon(int16 x, int16 y, byte which); void drawScreenLine(int16 x, int16 y, int16 x2, int16 y2, Color color); diff --git a/engines/avalanche/sound.cpp b/engines/avalanche/sound.cpp index 229d046cc1..0223bead48 100644 --- a/engines/avalanche/sound.cpp +++ b/engines/avalanche/sound.cpp @@ -51,6 +51,7 @@ void SoundHandler::stopSound() { */ void SoundHandler::toggleSound() { _soundFl = !_soundFl; + _vm->_graphics->drawSoundLight(_soundFl); } void SoundHandler::syncVolume() { -- cgit v1.2.3