From 874be3cfb49027df093d984f0ff1b98ddd13708f Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 5 May 2008 18:50:42 +0000 Subject: Implemented opcode 91: o3_daggerWarning. svn-id: r31882 --- engines/kyra/kyra_mr.h | 1 + engines/kyra/kyra_v2.cpp | 8 +++-- engines/kyra/screen_mr.cpp | 14 +++++++++ engines/kyra/screen_mr.h | 2 ++ engines/kyra/script_mr.cpp | 77 +++++++++++++++++++++++++++++++++++++++++++++- 5 files changed, 98 insertions(+), 4 deletions(-) diff --git a/engines/kyra/kyra_mr.h b/engines/kyra/kyra_mr.h index 7abca43513..3dba3ec8d9 100644 --- a/engines/kyra/kyra_mr.h +++ b/engines/kyra/kyra_mr.h @@ -559,6 +559,7 @@ private: int o3_stopMusic(EMCState *script); int o3_playSoundEffect(EMCState *script); int o3_getScore(EMCState *script); + int o3_daggerWarning(EMCState *script); int o3_blockOutRegion(EMCState *script); int o3_showSceneStringsMessage(EMCState *script); int o3_showGoodConscience(EMCState *script); diff --git a/engines/kyra/kyra_v2.cpp b/engines/kyra/kyra_v2.cpp index e981522662..176f8e4e2f 100644 --- a/engines/kyra/kyra_v2.cpp +++ b/engines/kyra/kyra_v2.cpp @@ -124,7 +124,6 @@ int KyraEngine_v2::checkInput(Button *buttonList, bool mainLoop) { Common::Point pos = getMousePos(); _mouseX = pos.x; _mouseY = pos.y; - screen()->updateScreen(); } break; case Common::EVENT_LBUTTONDOWN: @@ -132,7 +131,7 @@ int KyraEngine_v2::checkInput(Button *buttonList, bool mainLoop) { Common::Point pos = getMousePos(); _mouseX = pos.x; _mouseY = pos.y; - keys = event.type == Common::EVENT_LBUTTONDOWN ? 199 : (200 | 0x800); + keys = (event.type == Common::EVENT_LBUTTONDOWN ? 199 : (200 | 0x800)); breakLoop = true; } break; @@ -174,8 +173,11 @@ void KyraEngine_v2::updateInput() { _eventList.push_back(Event(event, true)); break; - case Common::EVENT_LBUTTONUP: case Common::EVENT_MOUSEMOVE: + screen_v2()->updateScreen(); + // fall through + + case Common::EVENT_LBUTTONUP: _eventList.push_back(event); break; diff --git a/engines/kyra/screen_mr.cpp b/engines/kyra/screen_mr.cpp index 0fcfe00879..4cea50927c 100644 --- a/engines/kyra/screen_mr.cpp +++ b/engines/kyra/screen_mr.cpp @@ -135,4 +135,18 @@ int Screen_MR::getDrawLayer2(int x, int y, int height) { return layer; } +void Screen_MR::drawFilledBox(int x1, int y1, int x2, int y2, uint8 c1, uint8 c2, uint8 c3) { + debugC(9, kDebugLevelScreen, "Screen_MR::drawFilledBox(%d, %d, %d, %d, %d, %d, %d,)", x1, y1, x2, y2, c1, c2, c3); + + fillRect(x1, y1, x2, y2, c1); + + fillRect(x1, y1, x2, y1+1, c2); + fillRect(x2-1, y1, x2, y2, c2); + + drawClippedLine(x1, y1, x1, y2, c3); + drawClippedLine(x1+1, y1+1, x1+1, y2-2, c3); + drawClippedLine(x1, y2, x2, y2, c3); + drawClippedLine(x1, y2-1, x2-1, y2-1, c3); +} + } // end of namespace Kyra diff --git a/engines/kyra/screen_mr.h b/engines/kyra/screen_mr.h index fe3ae2a930..7fbcbdcb6e 100644 --- a/engines/kyra/screen_mr.h +++ b/engines/kyra/screen_mr.h @@ -47,6 +47,8 @@ public: int getDrawLayer(int x, int y); int getDrawLayer2(int x, int y, int height); + + void drawFilledBox(int x1, int y1, int x2, int y2, uint8 c1, uint8 c2, uint8 c3); private: static const ScreenDim _screenDimTable[]; static const int _screenDimTableCount; diff --git a/engines/kyra/script_mr.cpp b/engines/kyra/script_mr.cpp index d0e66141f6..df7e5cc522 100644 --- a/engines/kyra/script_mr.cpp +++ b/engines/kyra/script_mr.cpp @@ -723,6 +723,81 @@ int KyraEngine_MR::o3_getScore(EMCState *script) { return _score; } +int KyraEngine_MR::o3_daggerWarning(EMCState *script) { + debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_daggerWarning(%p) ()", (const void *)script); + int selection = 1; + + _screen->hideMouse(); + _screen->copyRegionToBuffer(0, 0, 0, 320, 200, _screenBuffer); + int curPageBackUp = _screen->_curPage; + _screen->_curPage = 2; + + _screen->drawFilledBox(0, 0, 0x13F, 0xC7, 0xB4, 0xB3, 0xB6); + _screen->drawFilledBox(0xF, 0xAA, 0x68, 0xBA, 0xB4, 0xB3, 0xB6); + _screen->drawFilledBox(0x73, 0xAA, 0xCC, 0xBA, 0xB4, 0xB3, 0xB6); + _screen->drawFilledBox(0xD6, 0xAA, 0x12F, 0xBA, 0xB4, 0xB3, 0xB6); + + int y = 15; + for (int i = 100; i <= 107; ++i) { + const char *str = (const char *)getTableEntry(_cCodeFile, i); + int x = _text->getCenterStringX(str, 0, 0x13F); + _text->printText(str, x, y, 0xFF, 0xF0, 0x00); + y += 10; + } + y += 15; + for (int i = 110; i <= 113; ++i) { + const char *str = (const char *)getTableEntry(_cCodeFile, i); + int x = _text->getCenterStringX(str, 0, 0x13F); + _text->printText(str, x, y, 0xFF, 0xF0, 0x00); + y += 10; + } + + const char *str = 0; + int x = 0; + + str = (const char *)getTableEntry(_cCodeFile, 120); + x = _text->getCenterStringX(str, 0xF, 0x68); + _text->printText(str, x, 174, 0xFF, 0xF0, 0x00); + + str = (const char *)getTableEntry(_cCodeFile, 121); + x = _text->getCenterStringX(str, 0x73, 0xCC); + _text->printText(str, x, 174, 0xFF, 0xF0, 0x00); + + str = (const char *)getTableEntry(_cCodeFile, 122); + x = _text->getCenterStringX(str, 0xD6, 0x12F); + _text->printText(str, x, 174, 0xFF, 0xF0, 0x00); + + _screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0); + _screen->updateScreen(); + + _screen->_curPage = curPageBackUp; + _screen->showMouse(); + + while (!_quitFlag) { + int keys = checkInput(0); + removeInputTop(); + + if (keys == 198 || keys == 199) { + if (_mouseX >= 15 && _mouseX <= 104 && _mouseY >= 170 && _mouseY <= 186) { + selection = 1; + break; + } else if (_mouseX >= 115 && _mouseX <= 204 && _mouseY >= 170 && _mouseY <= 186) { + selection = 2; + break; + } else if (_mouseX >= 214 && _mouseX <= 303 && _mouseY >= 170 && _mouseY <= 186) { + selection = 3; + break; + } + } + + delay(10); + } + + restorePage3(); + _screen->copyBlockToPage(1, 0, 0, 320, 200, _screenBuffer); + return selection; +} + int KyraEngine_MR::o3_blockOutRegion(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_blockOutRegion(%p) (%d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3)); const int x1 = stackPos(0); @@ -1175,7 +1250,7 @@ void KyraEngine_MR::setupOpcodeTable() { Opcode(o2_playWanderScoreViaMap); Opcode(o3_playSoundEffect); Opcode(o3_getScore); - OpcodeUnImpl(); + Opcode(o3_daggerWarning); // 0x5c Opcode(o3_blockOutRegion); Opcode(o3_dummy); -- cgit v1.2.3