SHERLOCK: Move Settings dialog event handling into Settings class
This commit is contained in:
parent
86dab70eae
commit
850bd73968
5 changed files with 146 additions and 148 deletions
|
@ -1440,7 +1440,7 @@ void UserInterface::doMainControl() {
|
|||
case 'S':
|
||||
pushButton(11);
|
||||
_menuMode = SETUP_MODE;
|
||||
doControls();
|
||||
Settings::show(_vm);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -1837,150 +1837,6 @@ void UserInterface::journalControl() {
|
|||
screen.slamArea(0, 0, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles input when the settings window is being shown
|
||||
* @remarks Whilst this would in theory be better in the Journal class, since it displays in
|
||||
* the user interface, it uses so many internal UI fields, that it sort of made some sense
|
||||
* to put it in the UserInterface class.
|
||||
*/
|
||||
void UserInterface::doControls() {
|
||||
Events &events = *_vm->_events;
|
||||
People &people = *_vm->_people;
|
||||
Scene &scene = *_vm->_scene;
|
||||
Screen &screen = *_vm->_screen;
|
||||
Sound &sound = *_vm->_sound;
|
||||
Talk &talk = *_vm->_talk;
|
||||
UserInterface &ui = *_vm->_ui;
|
||||
int found;
|
||||
bool updateConfig = false;
|
||||
|
||||
Settings settings(_vm);
|
||||
settings.drawInteface(false);
|
||||
|
||||
do {
|
||||
if (_menuCounter)
|
||||
whileMenuCounter();
|
||||
|
||||
found = -1;
|
||||
_key = -1;
|
||||
|
||||
scene.doBgAnim();
|
||||
if (talk._talkToAbort)
|
||||
return;
|
||||
|
||||
events.setButtonState();
|
||||
Common::Point pt = events.mousePos();
|
||||
|
||||
if (events._pressed || events._released || events.kbHit()) {
|
||||
clearInfo();
|
||||
_key = -1;
|
||||
|
||||
if (events.kbHit()) {
|
||||
Common::KeyState keyState = events.getKey();
|
||||
_key = toupper(keyState.keycode);
|
||||
|
||||
if (_key == Common::KEYCODE_RETURN || _key == Common::KEYCODE_SPACE) {
|
||||
events._pressed = false;
|
||||
events._oldButtons = 0;
|
||||
_keycode = Common::KEYCODE_INVALID;
|
||||
events._released = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Handle highlighting button under mouse
|
||||
found = settings.drawButtons(pt, _key);
|
||||
}
|
||||
|
||||
if ((found == 0 && events._released) || (_key == 'E' || _key == Common::KEYCODE_ESCAPE))
|
||||
// Exit
|
||||
break;
|
||||
|
||||
if ((found == 1 && events._released) || _key == 'M') {
|
||||
// Toggle music
|
||||
if (sound._music) {
|
||||
sound.stopSound();
|
||||
sound._music = false;
|
||||
} else {
|
||||
sound._music = true;
|
||||
sound.startSong();
|
||||
}
|
||||
|
||||
updateConfig = true;
|
||||
settings.drawInteface(true);
|
||||
}
|
||||
|
||||
if ((found == 2 && events._released) || _key == 'V') {
|
||||
sound._voices = !sound._voices;
|
||||
updateConfig = true;
|
||||
settings.drawInteface(true);
|
||||
}
|
||||
|
||||
if ((found == 3 && events._released) || _key == 'S') {
|
||||
// Toggle sound effects
|
||||
sound._digitized = !sound._digitized;
|
||||
updateConfig = true;
|
||||
settings.drawInteface(true);
|
||||
}
|
||||
|
||||
if ((found == 4 && events._released) || _key == 'A') {
|
||||
// Help button style
|
||||
ui._helpStyle ^= 1;
|
||||
updateConfig = true;
|
||||
settings.drawInteface(true);
|
||||
}
|
||||
|
||||
if ((found == 5 && events._released) || _key == 'N') {
|
||||
// New font style
|
||||
int fontNum = screen.fontNumber() + 1;
|
||||
if (fontNum == 3)
|
||||
fontNum = 0;
|
||||
|
||||
screen.setFont(fontNum);
|
||||
updateConfig = true;
|
||||
settings.drawInteface(true);
|
||||
}
|
||||
|
||||
if ((found == 6 && events._released) || _key == 'J') {
|
||||
// Toggle joystick - not implemented under ScummVM
|
||||
}
|
||||
|
||||
if ((found == 7 && events._released) || _key == 'C') {
|
||||
// Calibrate joystick - No implementation in ScummVM
|
||||
}
|
||||
|
||||
if ((found == 8 && events._released) || _key == 'F') {
|
||||
// Toggle fade style
|
||||
screen._fadeStyle = !screen._fadeStyle;
|
||||
updateConfig = true;
|
||||
settings.drawInteface(true);
|
||||
}
|
||||
|
||||
if ((found == 9 && events._released) || _key == 'W') {
|
||||
// Window style
|
||||
ui._windowStyle ^= 1;
|
||||
updateConfig = true;
|
||||
settings.drawInteface(true);
|
||||
}
|
||||
|
||||
if ((found == 10 && events._released) || _key == 'P') {
|
||||
// Toggle portraits being shown
|
||||
people._portraitsOn = !people._portraitsOn;
|
||||
updateConfig = true;
|
||||
settings.drawInteface(true);
|
||||
}
|
||||
} while (!_vm->shouldQuit());
|
||||
|
||||
banishWindow();
|
||||
|
||||
if (updateConfig)
|
||||
_vm->saveConfig();
|
||||
|
||||
_keycode = Common::KEYCODE_INVALID;
|
||||
_keyboardInput = false;
|
||||
_windowBounds.top = CONTROLS_Y1;
|
||||
_key = -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Print the description of an object
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue