TWINE: allow to quit from menus
This commit is contained in:
parent
1d3fa8e950
commit
f9bcdaae46
1 changed files with 17 additions and 8 deletions
|
@ -100,6 +100,8 @@ enum AdvOptionsMenuType {
|
||||||
kSceneryZoom = 8
|
kSceneryZoom = 8
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define kQuitEngine -1
|
||||||
|
|
||||||
namespace _priv {
|
namespace _priv {
|
||||||
/** Main Menu Settings
|
/** Main Menu Settings
|
||||||
|
|
||||||
|
@ -367,7 +369,7 @@ void Menu::drawButtonGfx(int32 width, int32 topheight, int32 buttonId, int32 tex
|
||||||
newWidth = _engine->_screens->crossDot(left, right, Audio::Mixer::kMaxMixerVolume, volume);
|
newWidth = _engine->_screens->crossDot(left, right, Audio::Mixer::kMaxMixerVolume, volume);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
processPlasmaEffect(left, top, 80);
|
processPlasmaEffect(left, top, 80);
|
||||||
if (!(_engine->getRandomNumber() % 5)) {
|
if (!(_engine->getRandomNumber() % 5)) {
|
||||||
|
@ -394,8 +396,6 @@ void Menu::drawButtonGfx(int32 width, int32 topheight, int32 buttonId, int32 tex
|
||||||
const int32 textSize = _engine->_text->getTextSize(dialText);
|
const int32 textSize = _engine->_text->getTextSize(dialText);
|
||||||
_engine->_text->drawText(width - (textSize / 2), topheight - 18, dialText);
|
_engine->_text->drawText(width - (textSize / 2), topheight - 18, dialText);
|
||||||
|
|
||||||
// TODO: make volume buttons
|
|
||||||
|
|
||||||
_engine->copyBlockPhys(left, top, right, bottom);
|
_engine->copyBlockPhys(left, top, right, bottom);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -422,7 +422,6 @@ void Menu::drawButton(const int16 *menuSettings, bool hover) {
|
||||||
// get menu item settings
|
// get menu item settings
|
||||||
uint8 menuItemId = (uint8)*localData;
|
uint8 menuItemId = (uint8)*localData;
|
||||||
localData += 1;
|
localData += 1;
|
||||||
// applicable for sound menus, to save the volume/sound bar
|
|
||||||
uint16 textId = *localData;
|
uint16 textId = *localData;
|
||||||
localData += 1;
|
localData += 1;
|
||||||
if (hover) {
|
if (hover) {
|
||||||
|
@ -564,7 +563,7 @@ int32 Menu::processMenu(int16 *menuSettings) {
|
||||||
// draw plasma effect for the current selected button
|
// draw plasma effect for the current selected button
|
||||||
drawButton(menuSettings, true);
|
drawButton(menuSettings, true);
|
||||||
if (_engine->shouldQuit()) {
|
if (_engine->shouldQuit()) {
|
||||||
break;
|
return kQuitEngine;
|
||||||
}
|
}
|
||||||
// TODO: update volume settings
|
// TODO: update volume settings
|
||||||
_engine->_system->delayMillis(10);
|
_engine->_system->delayMillis(10);
|
||||||
|
@ -589,6 +588,8 @@ int32 Menu::advoptionsMenu() {
|
||||||
ret = 1; // quit option menu
|
ret = 1; // quit option menu
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case kQuitEngine:
|
||||||
|
return kQuitEngine;
|
||||||
//TODO: add other options
|
//TODO: add other options
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -610,6 +611,8 @@ int32 Menu::savemanageMenu() {
|
||||||
ret = 1; // quit option menu
|
ret = 1; // quit option menu
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case kQuitEngine:
|
||||||
|
return kQuitEngine;
|
||||||
//TODO: add other options
|
//TODO: add other options
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -631,6 +634,8 @@ int32 Menu::volumeMenu() {
|
||||||
ret = 1; // quit option menu
|
ret = 1; // quit option menu
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case kQuitEngine:
|
||||||
|
return kQuitEngine;
|
||||||
//TODO: add other options
|
//TODO: add other options
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -651,6 +656,8 @@ int32 Menu::optionsMenu() {
|
||||||
|
|
||||||
do {
|
do {
|
||||||
switch (processMenu(OptionsMenuState)) {
|
switch (processMenu(OptionsMenuState)) {
|
||||||
|
case kQuitEngine:
|
||||||
|
return kQuitEngine;
|
||||||
case kReturnGame:
|
case kReturnGame:
|
||||||
case kReturnMenu: {
|
case kReturnMenu: {
|
||||||
ret = 1; // quit option menu
|
ret = 1; // quit option menu
|
||||||
|
@ -671,9 +678,6 @@ int32 Menu::optionsMenu() {
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (_engine->shouldQuit()) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} while (ret != 1);
|
} while (ret != 1);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -716,6 +720,8 @@ void Menu::run() {
|
||||||
_engine->_screens->loadMenuImage();
|
_engine->_screens->loadMenuImage();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case kQuitEngine:
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
_engine->_system->delayMillis(1000 / _engine->cfgfile.Fps);
|
_engine->_system->delayMillis(1000 / _engine->cfgfile.Fps);
|
||||||
}
|
}
|
||||||
|
@ -735,6 +741,9 @@ int32 Menu::giveupMenu() {
|
||||||
do {
|
do {
|
||||||
_engine->_text->initTextBank(0);
|
_engine->_text->initTextBank(0);
|
||||||
menuId = processMenu(localMenu);
|
menuId = processMenu(localMenu);
|
||||||
|
if (menuId == kQuitEngine) {
|
||||||
|
return kQuitEngine;
|
||||||
|
}
|
||||||
_engine->_text->initTextBank(_engine->_text->currentTextBank + 3);
|
_engine->_text->initTextBank(_engine->_text->currentTextBank + 3);
|
||||||
_engine->_system->delayMillis(1000 / _engine->cfgfile.Fps);
|
_engine->_system->delayMillis(1000 / _engine->cfgfile.Fps);
|
||||||
} while (menuId != kGiveUp && menuId != kContinue);
|
} while (menuId != kGiveUp && menuId != kContinue);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue