From e4989b37b744db0edc8ff8e06e7afc8867570af3 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Sun, 28 May 2006 16:22:12 +0000 Subject: Mock-up version of the Kyra 3 main menu. Just enough to be able to select the intro cutscene. svn-id: r22724 --- engines/kyra/kyra3.cpp | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) (limited to 'engines') diff --git a/engines/kyra/kyra3.cpp b/engines/kyra/kyra3.cpp index f303b1a5ca..737fbcb027 100644 --- a/engines/kyra/kyra3.cpp +++ b/engines/kyra/kyra3.cpp @@ -30,6 +30,9 @@ #include "common/system.h" #include "common/config-manager.h" +// TODO: Temporary, to get the mouse cursor mock-up working +#include "graphics/cursorman.h" + namespace Kyra { KyraEngine_v3::KyraEngine_v3(OSystem *system) : KyraEngine(system) { _soundDigital = 0; @@ -131,6 +134,8 @@ int KyraEngine_v3::go() { break; case 1: + playVQA("K3INTRO"); + // TODO: Restart the menu animation break; case 2: @@ -223,8 +228,41 @@ int KyraEngine_v3::handleMainMenu(WSAMovieV3 *logo) { uint32 nextRun = 0; drawMainMenu(strings); + +#define A 0x00 +#define B 0xFF +#define C 0x7F + + // TODO: This is just a mock-up of the real mouse cursor. + const byte cursorImage[] = { + A, A, C, C, C, C, C, C, C, C, + A, B, A, C, C, C, C, C, C, C, + A, B, B, A, C, C, C, C, C, C, + A, B, B, B, A, C, C, C, C, C, + A, B, B, B, B, A, C, C, C, C, + A, B, B, B, B, B, A, C, C, C, + A, B, B, B, B, B, B, A, C, C, + A, B, B, B, B, B, B, B, A, C, + A, B, B, B, B, B, B, B, B, A, + C, A, A, A, B, B, B, A, A, C, + C, C, C, C, A, B, B, B, A, C, + C, C, C, C, C, A, B, B, B, A, + C, C, C, C, C, C, A, A, A, C + }; + _system->warpMouse(300, 180); + CursorMan.replaceCursor(cursorImage, 10, 13, 1, 1, C); + _screen->hideMouse(); // HACK to get _mouseLockCount to 1. _screen->showMouse(); + +#undef A +#undef B +#undef C + + int fh = _screen->getFontHeight(); + int textPos = ((_screen->_curDim->w >> 1) + _screen->_curDim->sx) << 3; + + Common::Rect menuRect(x + 16, y + 4, x + width - 16, y + 4 + fh * 4); while (command == -1 && !_quitFlag) { // yes 2 * _tickLength here not 3 * like in the first draw @@ -249,6 +287,26 @@ int KyraEngine_v3::handleMainMenu(WSAMovieV3 *logo) { if ((int32)nextRun - (int32)_system->getMillis() >= 10) delay(10); } + + if (menuRect.contains(mouseX(), mouseY())) { + int item = (mouseY() - menuRect.top) / fh; + + if (item != _selectedMenuItem) { + gui_printString(strings[_selectedMenuItem], textPos, menuRect.top + _selectedMenuItem * fh, 0x80, 0, 5); + gui_printString(strings[item], textPos, menuRect.top + item * fh, 0xFF, 0, 5); + + _selectedMenuItem = item; + } + + if (_mousePressFlag) { + // TODO: Flash the text + command = item; + + // TODO: For now, only the intro is supported + if (command != 1) + command = -1; + } + } } if (_quitFlag) -- cgit v1.2.3