diff --git a/saga/input.cpp b/saga/input.cpp index 3d2754220ae..b85b2fbe8fd 100644 --- a/saga/input.cpp +++ b/saga/input.cpp @@ -100,6 +100,9 @@ int SagaEngine::processInput() { break; case 289: // F8 break; + case 290: // F9 + _interface->keyBoss(); + break; // Actual game keys case 32: // space diff --git a/saga/interface.cpp b/saga/interface.cpp index ccb172345fd..06dab0a3bf5 100644 --- a/saga/interface.cpp +++ b/saga/interface.cpp @@ -177,6 +177,7 @@ Interface::Interface(SagaEngine *vm) : _vm(vm) { _active = true; _panelMode = _lockedMode = kPanelNull; _savedMode = -1; + _bossMode = -1; _fadeMode = kNoFade; _inMainMode = false; *_statusText = 0; @@ -313,6 +314,9 @@ void Interface::setMode(int mode) { break; case kPanelChapterSelection: break; + case kPanelBoss: + _vm->_render->setFlag(RF_DEMO_SUBST); + break; } draw(); @@ -487,6 +491,10 @@ bool Interface::processAscii(uint16 ascii, bool synthetic) { _vm->shutDown(); } break; + case kPanelBoss: + _vm->_render->clearFlag(RF_DEMO_SUBST); + keyBossExit(); + break; } return false; } @@ -2298,4 +2306,81 @@ void Interface::mapPanelDrawCrossHair() { } } +void Interface::keyBoss() { + if (_vm->getGameType() != GType_IHNM) + return; + + if (_bossMode != -1 || _fadeMode != kNoFade) + return; + + _vm->_sound->pauseVoice(); + _vm->_sound->pauseSound(); + _vm->_music->pause(); + + int i; + byte *resource; + size_t resourceLength, imageLength; + Surface *backBuffer; + Rect rect; + byte *image; + int imageWidth, imageHeight; + const byte *pal; + PalEntry cPal[PAL_ENTRIES]; + + _vm->_gfx->showCursor(false); + + backBuffer = _vm->_gfx->getBackBuffer(); + + rect.left = rect.top = 0; + + _vm->_resource->loadResource(_interfaceContext, RID_IHNM_BOSS_SCREEN, resource, resourceLength); + if (resourceLength == 0) { + error("Interface::bossKey() unable to load Boss image resource"); + } + + _bossMode = _panelMode; + setMode(kPanelBoss); + + _vm->decodeBGImage(resource, resourceLength, &image, &imageLength, &imageWidth, &imageHeight); + rect.setWidth(imageWidth); + rect.setHeight(imageHeight); + + _vm->_gfx->getCurrentPal(_mapSavedPal); + pal = _vm->getImagePal(resource, resourceLength); + + for (i = 0; i < PAL_ENTRIES; i++) { + cPal[i].red = *pal++; + cPal[i].green = *pal++; + cPal[i].blue = *pal++; + } + + backBuffer->blit(rect, image); + + _vm->_gfx->setPalette(cPal); + + free(resource); + free(image); +} + + +void Interface::keyBossExit() { + PalEntry pal[PAL_ENTRIES]; + + _vm->_sound->resumeVoice(); + _vm->_sound->resumeSound(); + _vm->_music->resume(); + + _vm->_gfx->getCurrentPal(pal); + + _vm->_gfx->palToBlack(pal, 1); + setMode(_bossMode); + + _vm->_render->drawScene(); + + _vm->_gfx->blackToPal(_mapSavedPal, 1); + + _bossMode = -1; +} + + } // End of namespace Saga diff --git a/saga/interface.h b/saga/interface.h index 4fdacf30c08..306819a2b8e 100644 --- a/saga/interface.h +++ b/saga/interface.h @@ -70,7 +70,8 @@ enum PanelModes { kPanelSceneSubstitute, kPanelChapterSelection, kPanelCutaway, - kPanelVideo + kPanelVideo, + kPanelBoss // kPanelInventory }; @@ -243,6 +244,9 @@ public: bool processAscii(uint16 ascii, bool synthetic = false); void processKeyUp(uint16 ascii); + void keyBoss(); + void keyBossExit(); + void disableAbortSpeeches(bool d) { _disableAbortSpeeches = d; } bool _textInput; @@ -423,6 +427,7 @@ private: int _panelMode; int _savedMode; int _lockedMode; + int _bossMode; bool _inMainMode; char _statusText[STATUS_TEXT_LEN]; int _statusOnceColor; diff --git a/saga/resnames.h b/saga/resnames.h index bb42aa53f52..aa1e1d573a8 100644 --- a/saga/resnames.h +++ b/saga/resnames.h @@ -87,6 +87,8 @@ namespace Saga { #define RID_IHNM_MAIN_PANEL_SPRITES 13 // TODO: verify this #define RID_IHNM_MAIN_STRINGS 21 +#define RID_IHNM_BOSS_SCREEN 19 + // Puzzle portraits #define RID_ITE_SAKKA_APPRAISING 6 #define RID_ITE_SAKKA_DENIAL 7