MYST3: Menu WIP

- Escape now closes the menu
- Fix loading non first save item
- Clicking twice on an item loads it
This commit is contained in:
Bastien Bouclet 2012-01-13 10:22:28 +01:00
parent 4fc45e4dc6
commit e031c97b2e
6 changed files with 16 additions and 7 deletions

View File

@ -129,6 +129,7 @@ void Menu::goToNode(uint16 node) {
_vm->_state->setMenuSavedNode(_vm->_state->getLocationNode());
}
_vm->_state->setMenuEscapePressed(0);
_vm->_state->setLocationNextAge(9);
_vm->_state->setLocationNextRoom(901);
_vm->goToNode(node, 2);
@ -267,6 +268,12 @@ void Menu::saveLoadUpdateVars() {
}
void Menu::loadMenuSelect(uint16 item) {
// Selecting twice the same item loads it
if (item == _vm->_state->getMenuSaveLoadSelectedItem()) {
loadMenuLoad();
return;
}
_vm->_state->setMenuSaveLoadSelectedItem(item);
int16 page = _vm->_state->getMenuSaveLoadCurrentPage();
@ -297,11 +304,10 @@ void Menu::loadMenuSelect(uint16 item) {
const DirectorySubEntry *desc = _vm->getFileDescription("AGES", 1000, 0, DirectorySubEntry::kTextMetadata);
_saveLoadAgeName = desc->getTextData(_vm->_db->getAgeLabelId(age));
_saveLoadAgeName.toUppercase();
// TODO: Selecting twice loads item
}
void Menu::loadMenuLoad(uint16 item) {
void Menu::loadMenuLoad() {
uint16 item = _vm->_state->getMenuSaveLoadSelectedItem();
int16 page = _vm->_state->getMenuSaveLoadCurrentPage();
uint16 index = page * 7 + item;

View File

@ -49,7 +49,7 @@ public:
void loadMenuOpen();
void loadMenuSelect(uint16 item);
void loadMenuLoad(uint16 item);
void loadMenuLoad();
void loadMenuChangePage();
void setSaveLoadSpotItem(SpotItemFace *spotItem) { _saveLoadSpotItem = spotItem; }

View File

@ -274,9 +274,10 @@ void Myst3Engine::processInput(bool lookOnly) {
switch (event.kbd.keycode) {
case Common::KEYCODE_ESCAPE:
// Open main menu
if (_state->getLocationRoom() != 901) {
if (_state->getLocationRoom() != 901)
_menu->goToNode(100);
}
else
_state->setMenuEscapePressed(1);
break;
case Common::KEYCODE_d:
if (event.kbd.flags & Common::KBD_CTRL) {

View File

@ -178,7 +178,7 @@ void Puzzles::saveLoadMenu(uint16 action, uint16 item) {
_vm->_menu->loadMenuSelect(item);
break;
case 2:
_vm->_menu->loadMenuLoad(item);
_vm->_menu->loadMenuLoad();
break;
case 6:
_vm->_menu->loadMenuChangePage();

View File

@ -94,6 +94,7 @@ GameState::GameState(Myst3Engine *vm):
VAR(480, BookStateTomahna, false)
VAR(481, BookStateReleeshahn, false)
VAR(1337, MenuEscapePressed, false)
VAR(1339, MenuLoadBack, false)
VAR(1340, MenuSaveBack, false)
VAR(1341, MenuSaveAction, false)

View File

@ -101,6 +101,7 @@ public:
DECLARE_VAR(480, BookStateTomahna)
DECLARE_VAR(481, BookStateReleeshahn)
DECLARE_VAR(1337, MenuEscapePressed)
DECLARE_VAR(1339, MenuLoadBack)
DECLARE_VAR(1340, MenuSaveBack)
DECLARE_VAR(1341, MenuSaveAction)