aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra
diff options
context:
space:
mode:
authorFlorian Kagerer2009-06-16 21:23:26 +0000
committerFlorian Kagerer2009-06-16 21:23:26 +0000
commit0b4725d142f56665f9b032e393db1d010b2bde05 (patch)
tree178367edf6ef3349bb54f2a92a2647f88905b58b /engines/kyra
parent72fedd3eb0b1e693dcaa2c8308cf5c2f93791d82 (diff)
downloadscummvm-rg350-0b4725d142f56665f9b032e393db1d010b2bde05.tar.gz
scummvm-rg350-0b4725d142f56665f9b032e393db1d010b2bde05.tar.bz2
scummvm-rg350-0b4725d142f56665f9b032e393db1d010b2bde05.zip
LOL: implemented options menu (settings aren't saved yet)
svn-id: r41596
Diffstat (limited to 'engines/kyra')
-rw-r--r--engines/kyra/gui.cpp4
-rw-r--r--engines/kyra/gui_lol.cpp92
-rw-r--r--engines/kyra/gui_lol.h3
-rw-r--r--engines/kyra/lol.cpp2
-rw-r--r--engines/kyra/sequences_lol.cpp22
-rw-r--r--engines/kyra/staticres.cpp15
6 files changed, 109 insertions, 29 deletions
diff --git a/engines/kyra/gui.cpp b/engines/kyra/gui.cpp
index be61222e3a..c28ad68df4 100644
--- a/engines/kyra/gui.cpp
+++ b/engines/kyra/gui.cpp
@@ -154,7 +154,9 @@ void GUI::initMenu(Menu &menu) {
for (int i = 0; i < menu.numberOfItems; ++i) {
if (getMenuItemLabel(menu.item[i])) {
if (_vm->gameFlags().gameID == GI_LOL) {
- printMenuText(getMenuItemLabel(menu.item[i]), menu.x + menu.item[i].labelX, menu.y + menu.item[i].labelY, menu.item[i].textColor, 0, 8);
+ menu.item[i].labelX = menu.item[i].x - 1;
+ menu.item[i].labelY = menu.item[i].y + 3;
+ printMenuText(getMenuItemLabel(menu.item[i]), menu.x + menu.item[i].labelX, menu.y + menu.item[i].labelY, menu.item[i].textColor, 0, 10);
} else {
printMenuText(getMenuItemLabel(menu.item[i]), menu.x + menu.item[i].labelX - 1, menu.y + menu.item[i].labelY + 1, defaultColor1(), 0, 0);
printMenuText(getMenuItemLabel(menu.item[i]), menu.x + menu.item[i].labelX, menu.y + menu.item[i].labelY, menu.item[i].textColor, 0, 0);
diff --git a/engines/kyra/gui_lol.cpp b/engines/kyra/gui_lol.cpp
index f9f320f1be..fbcd4f0572 100644
--- a/engines/kyra/gui_lol.cpp
+++ b/engines/kyra/gui_lol.cpp
@@ -1570,15 +1570,7 @@ int LoLEngine::clickedOptions(Button *button) {
enableSysTimer(2);
updateDrawPage2();
- char filename[13];
- snprintf(filename, sizeof(filename), "LEVEL%02d.%s", _currentLevel, _languageExt[_lang]);
- if (_levelLangFile)
- delete[] _levelLangFile;
- _levelLangFile = _res->fileData(filename, 0);
- snprintf(filename, sizeof(filename), "LANDS.%s", _languageExt[_lang]);
- if (_landsFile)
- delete[] _landsFile;
- _landsFile = _res->fileData(filename, 0);
+ gui_drawPlayField();
// if (!_speechFlag)
// enableText()
@@ -1988,9 +1980,8 @@ int GUI_LoL::processButtonList(Button *buttonList, uint16 inputFlag, int8 mouseW
}
}
- Common::Point p = _vm->getMousePos();
- int mouseX = p.x;
- int mouseY = p.y;
+ int mouseX = _vm->_mouseX;
+ int mouseY = _vm->_mouseY;
uint16 flags = 0;
@@ -2251,6 +2242,34 @@ int GUI_LoL::runMenu(Menu &menu) {
setupSavegameNames(*_currentMenu, 4);
}
+ if (_currentMenu == &_gameOptions) {
+ char *s = (char *)_vm->_tempBuffer5120;
+ strncpy(s, _vm->getLangString(0x406f + _vm->_monsterDifficulty), 30);
+ s[29] = 0;
+ _currentMenu->item[0].itemString = s;
+ s += (strlen(s) + 1);
+
+ strncpy(s, _vm->getLangString(_vm->_smoothScrollingEnabled ? 0x4068 : 0x4069), 30);
+ s[29] = 0;
+ _currentMenu->item[1].itemString = s;
+ s += (strlen(s) + 1);
+
+ strncpy(s, _vm->getLangString(_vm->_floatingCursorsEnabled ? 0x4068 : 0x4069), 30);
+ s[29] = 0;
+ _currentMenu->item[2].itemString = s;
+ s += (strlen(s) + 1);
+
+ strncpy(s, _vm->getLangString(0x42d6 + _vm->_lang), 30);
+ s[29] = 0;
+ _currentMenu->item[3].itemString = s;
+ s += (strlen(s) + 1);
+
+ strncpy(s, _vm->getLangString(_vm->textEnabled() ? 0x4068 : 0x4069), 30);
+ s[29] = 0;
+ _currentMenu->item[4].itemString = s;
+ s += (strlen(s) + 1);
+ }
+
hasScrollButtons = _currentMenu->highlightedItem;
_currentMenu->highlightedItem = 255;
@@ -2281,7 +2300,7 @@ int GUI_LoL::runMenu(Menu &menu) {
if (_currentMenu == &_mainMenu) {
Screen::FontId f = _screen->setFont(Screen::FID_6_FNT);
- _screen->fprintString("SVN %s", menu.x + 8, menu.y + menu.height - 12, 204, 0, 8, gScummVMVersion);
+ _screen->fprintString("%s", menu.x + 8, menu.y + menu.height - 12, 204, 0, 8, gScummVMVersion);
_screen->setFont(f);
_screen->updateScreen();
}
@@ -2376,6 +2395,9 @@ int GUI_LoL::getInput() {
if (!_displayMenu)
return 0;
+ Common::Point p = _vm->getMousePos();
+ _vm->_mouseX = p.x;
+ _vm->_mouseY = p.y;
int inputFlag = _vm->checkInput(_menuButtonList);
_vm->removeInputTop();
@@ -2399,7 +2421,7 @@ int GUI_LoL::clickedMainMenu(Button *button) {
//_newMenu = &_deleteMenu;
break;
case 0x4004:
- //_newMenu = &_gameOptions;
+ _newMenu = &_gameOptions;
break;
case 0x42D9:
//_newMenu = &_audioOptions;
@@ -2433,6 +2455,42 @@ int GUI_LoL::clickedLoadMenu(Button *button) {
return 1;
}
+int GUI_LoL::clickedOptionsMenu(Button *button) {
+ updateMenuButton(button);
+
+ switch (button->arg) {
+ case 0xfff7:
+ _vm->_monsterDifficulty = ++_vm->_monsterDifficulty % 3;
+ break;
+ case 0xfff6:
+ _vm->_smoothScrollingEnabled ^= true;
+ break;
+ case 0xfff5:
+ _vm->_floatingCursorsEnabled ^= true;
+ break;
+ case 0xfff4:
+ _vm->_lang = ++_vm->_lang % 3;
+ break;
+ case 0xfff3:
+ _vm->_configVoice ^= 1;
+ break;
+ case 0x4072:
+ char filename[13];
+ snprintf(filename, sizeof(filename), "LEVEL%02d.%s", _vm->_currentLevel, _vm->_languageExt[_vm->_lang]);
+ if (_vm->_levelLangFile)
+ delete[] _vm->_levelLangFile;
+ _vm->_levelLangFile = _vm->resource()->fileData(filename, 0);
+ snprintf(filename, sizeof(filename), "LANDS.%s", _vm->_languageExt[_vm->_lang]);
+ if (_vm->_landsFile)
+ delete[] _vm->_landsFile;
+ _vm->_landsFile = _vm->resource()->fileData(filename, 0);
+ _newMenu = _lastMenu;
+ break;
+ }
+
+ return 1;
+}
+
int GUI_LoL::clickedDeathMenu(Button *button) {
updateMenuButton(button);
if (button->arg == _deathMenu.item[0].itemId) {
@@ -2481,13 +2539,15 @@ const char *GUI_LoL::getMenuTitle(const Menu &menu) {
const char *GUI_LoL::getMenuItemTitle(const MenuItem &menuItem) {
if (menuItem.itemId & 0x8000 && menuItem.itemString)
return menuItem.itemString;
- else if (menuItem.itemId & 0x8000)
+ else if (menuItem.itemId & 0x8000 || !menuItem.itemId)
return 0;
return _vm->getLangString(menuItem.itemId);
}
const char *GUI_LoL::getMenuItemLabel(const MenuItem &menuItem) {
- if (!menuItem.labelId)
+ if (menuItem.labelId & 0x8000 && menuItem.labelString)
+ return menuItem.labelString;
+ else if (menuItem.labelId & 0x8000 || !menuItem.labelId)
return 0;
return _vm->getLangString(menuItem.labelId);
}
diff --git a/engines/kyra/gui_lol.h b/engines/kyra/gui_lol.h
index 62f1c5ed9e..ef636d0267 100644
--- a/engines/kyra/gui_lol.h
+++ b/engines/kyra/gui_lol.h
@@ -57,6 +57,7 @@ namespace Kyra {
do { \
item.enabled = 1; \
item.itemId = a; \
+ item.itemString = 0; \
item.x = b; \
item.y = c; \
item.width = d; \
@@ -69,6 +70,7 @@ namespace Kyra {
item.color2 = 227; \
item.saveSlot = 0; \
item.labelId = f; \
+ item.labelString = 0; \
item.labelX = 0; \
item.labelY = 0; \
item.keyCode = g; \
@@ -109,6 +111,7 @@ private:
int clickedMainMenu(Button *button);
int clickedLoadMenu(Button *button);
+ int clickedOptionsMenu(Button *button);
int clickedDeathMenu(Button *button);
int clickedChoiceMenu(Button *button);
diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp
index 3c67c897aa..107091a479 100644
--- a/engines/kyra/lol.cpp
+++ b/engines/kyra/lol.cpp
@@ -722,7 +722,7 @@ int LoLEngine::mainMenu() {
assert(menu);
menu->init(data[dataIndex], MainMenu::Animation());
- int selection = menu->handle(_flags.isTalkie ? (hasSave ? 17 : 6) : (hasSave ? 6 : 18));
+ int selection = menu->handle(_flags.isTalkie ? (hasSave ? 19 : 6) : (hasSave ? 6 : 20));
delete menu;
_screen->setScreenDim(0);
diff --git a/engines/kyra/sequences_lol.cpp b/engines/kyra/sequences_lol.cpp
index 19caae9878..10be977930 100644
--- a/engines/kyra/sequences_lol.cpp
+++ b/engines/kyra/sequences_lol.cpp
@@ -868,7 +868,7 @@ void LoLEngine::showCredits() {
_screen->_charOffset = 0;
char *credits = (char *)_res->fileData("CREDITS.TXT", 0);
- processCredits(credits, 19, 4, 5);
+ processCredits(credits, 21, 4, 5);
delete[] credits;
uint32 endTime = _system->getMillis() + 120 * _tickLength;
@@ -898,8 +898,8 @@ void LoLEngine::processCredits(char *t, int dimState, int page, int delayTime) {
uint8 *doorShape = _screen->makeShapeCopy(_screen->getCPagePtr(5), 0);
assert(doorShape);
- _screen->drawShape(0, doorShape, 0, 0, 20, 0x10);
- _screen->drawShape(0, doorShape, 0, 0, 21, 0x11);
+ _screen->drawShape(0, doorShape, 0, 0, 22, 0x10);
+ _screen->drawShape(0, doorShape, 0, 0, 23, 0x11);
int curShapeFile = 0;
uint8 *shapes[12];
@@ -1045,8 +1045,8 @@ void LoLEngine::processCredits(char *t, int dimState, int page, int delayTime) {
} else {
if (!monsterAnimFrame && doorRedraw) {
_screen->copyRegion(0, 0, 0, 0, 320, 200, 2, page, Screen::CR_NO_P_CHECK);
- _screen->drawShape(page, doorShape, 0, 0, 20, 0x10);
- _screen->drawShape(page, doorShape, 0, 0, 21, 0x11);
+ _screen->drawShape(page, doorShape, 0, 0, 22, 0x10);
+ _screen->drawShape(page, doorShape, 0, 0, 23, 0x11);
--frameCounter;
doorRedraw = false;
@@ -1065,32 +1065,32 @@ void LoLEngine::processCredits(char *t, int dimState, int page, int delayTime) {
bool isRightMonster = ((curShapeFile - 1) & 1) != 0;
if (isRightMonster) {
- doorSD = 21;
+ doorSD = 23;
doorX = _outroRightDoorPos[monsterAnimFrame * 2 + 0];
doorY = _outroRightDoorPos[monsterAnimFrame * 2 + 1];
monsterX = _outroRightMonsterPos[monsterAnimFrame * 2 + 0];
monsterY = _outroRightMonsterPos[monsterAnimFrame * 2 + 1];
- _screen->drawShape(page, doorShape, 0, 0, 20, 0x10);
+ _screen->drawShape(page, doorShape, 0, 0, 22, 0x10);
} else {
- doorSD = 20;
+ doorSD = 22;
doorX = _outroLeftDoorPos[monsterAnimFrame * 2 + 0];
doorY = _outroLeftDoorPos[monsterAnimFrame * 2 + 1];
monsterX = _outroLeftMonsterPos[monsterAnimFrame * 2 + 0];
monsterY = _outroLeftMonsterPos[monsterAnimFrame * 2 + 1];
- _screen->drawShape(page, doorShape, 0, 0, 21, 0x11);
+ _screen->drawShape(page, doorShape, 0, 0, 23, 0x11);
}
if (monsterAnimFrame >= 8)
- _screen->drawShape(page, doorShape, doorX, doorY, doorSD, (doorSD == 20) ? 0 : 1);
+ _screen->drawShape(page, doorShape, doorX, doorY, doorSD, (doorSD == 22) ? 0 : 1);
_screen->drawShape(page, monsterShape, monsterX, monsterY, 0, 0x104 | ((!isRightMonster | (monsterAnimFrame < 20)) ? 0 : 1), _outroShapeTable, 1, _outroMonsterScaleTableX[monsterAnimFrame], _outroMonsterScaleTableY[monsterAnimFrame]);
if (monsterAnimFrame < 8)
- _screen->drawShape(page, doorShape, doorX, doorY, doorSD, (doorSD == 20) ? 0 : 1);
+ _screen->drawShape(page, doorShape, doorX, doorY, doorSD, (doorSD == 22) ? 0 : 1);
_screen->copyRegion(0, 0, 0, 0, 320, 200, page, 6, Screen::CR_NO_P_CHECK);
doorRedraw = true;
diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp
index 341425172c..382d167d83 100644
--- a/engines/kyra/staticres.cpp
+++ b/engines/kyra/staticres.cpp
@@ -2040,6 +2040,17 @@ void GUI_LoL::initStaticData() {
for (int i = 0; i < 5; ++i)
_loadMenu.item[i].callback = loadMenuFunctor;
+ GUI_LOL_MENU(_gameOptions, 17, 0x400c, 0, 6, -1, -1, -1, -1);
+ GUI_LOL_MENU_ITEM(_gameOptions.item[0], 0xfff7, 120, 22, 80, 15, 0x406e, 0);
+ GUI_LOL_MENU_ITEM(_gameOptions.item[1], 0xfff6, 120, 39, 80, 15, 0x406c, 0);
+ GUI_LOL_MENU_ITEM(_gameOptions.item[2], 0xfff5, 120, 56, 80, 15, 0x406d, 0);
+ GUI_LOL_MENU_ITEM(_gameOptions.item[3], 0xfff4, 120, 73, 80, 15, 0x42d5, 0);
+ GUI_LOL_MENU_ITEM(_gameOptions.item[4], 0xfff3, 120, 90, 80, 15, 0x42d2, 0);
+ GUI_LOL_MENU_ITEM(_gameOptions.item[5], 0x4072, 104, 110, 96, 15, 0, 110);
+ Button::Callback optionsMenuFunctor = BUTTON_FUNCTOR(GUI_LoL, this, &GUI_LoL::clickedOptionsMenu);
+ for (int i = 0; i < 6; ++i)
+ _gameOptions.item[i].callback = optionsMenuFunctor;
+
GUI_LOL_MENU(_deathMenu, 11, 0x4013, 0, 2, -1, -1, -1, -1);
GUI_LOL_MENU_ITEM(_deathMenu.item[0], 0x4006, 8, 30, 104, 15, 0, 0);
GUI_LOL_MENU_ITEM(_deathMenu.item[1], 0x4001, 176, 30, 104, 15, 0, 0);
@@ -3061,6 +3072,8 @@ const ScreenDim Screen_LoL::_screenDimTable256C[] = {
{ 0x0D, 0xA2, 0x18, 0x0C, 0xFE, 0x01, 0x00, 0x00 },
{ 0x0F, 0x06, 0x14, 0x6E, 0x01, 0x00, 0x00, 0x00 },
{ 0x1A, 0xBE, 0x0A, 0x07, 0xFE, 0x01, 0x00, 0x00 },
+ { 0x07, 0x21, 0x1A, 0x85, 0x00, 0x00, 0x00, 0x00 },
+ { 0x03, 0x32, 0x22, 0x62, 0x00, 0x00, 0x00, 0x00 },
{ 0x0B, 0x8C, 0x10, 0x33, 0x3D, 0x01, 0x00, 0x00 }, // Main menu box (5 entries, CD version only)
{ 0x0B, 0x8C, 0x10, 0x23, 0x3D, 0x01, 0x00, 0x00 }, // Main menu box (3 entries, floppy version only)
@@ -3088,6 +3101,8 @@ const ScreenDim Screen_LoL::_screenDimTable16C[] = {
{ 0x0D, 0xA2, 0x18, 0x0C, 0x33, 0x44, 0x00, 0x00 },
{ 0x0F, 0x06, 0x14, 0x6E, 0x44, 0x00, 0x00, 0x00 },
{ 0x1A, 0xBE, 0x0A, 0x07, 0x33, 0x44, 0x00, 0x00 },
+ { 0x07, 0x21, 0x1A, 0x85, 0x00, 0x00, 0x00, 0x00 },
+ { 0x03, 0x32, 0x22, 0x62, 0x00, 0x00, 0x00, 0x00 },
{ 0x0B, 0x8C, 0x10, 0x33, 0x33, 0x44, 0x00, 0x00 }, // Main menu box (5 entries, not used here)
{ 0x0B, 0x8C, 0x10, 0x23, 0x33, 0x44, 0x00, 0x00 }, // Main menu box (3 entries)