SHERLOCK: Moved Settings dialog into it's own class
This commit is contained in:
parent
7d50c49f59
commit
a2ef3e2402
5 changed files with 258 additions and 196 deletions
|
@ -19,6 +19,7 @@ MODULE_OBJS = \
|
||||||
saveload.o \
|
saveload.o \
|
||||||
scene.o \
|
scene.o \
|
||||||
screen.o \
|
screen.o \
|
||||||
|
settings.o \
|
||||||
sherlock.o \
|
sherlock.o \
|
||||||
sound.o \
|
sound.o \
|
||||||
talk.o \
|
talk.o \
|
||||||
|
|
211
engines/sherlock/settings.cpp
Normal file
211
engines/sherlock/settings.cpp
Normal file
|
@ -0,0 +1,211 @@
|
||||||
|
/* ScummVM - Graphic Adventure Engine
|
||||||
|
*
|
||||||
|
* ScummVM is the legal property of its developers, whose names
|
||||||
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||||
|
* file distributed with this source distribution.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "sherlock/sherlock.h"
|
||||||
|
#include "sherlock/settings.h"
|
||||||
|
|
||||||
|
namespace Sherlock {
|
||||||
|
|
||||||
|
const int SETUP_POINTS[12][4] = {
|
||||||
|
{ 4, 154, 101, 53 }, // Exit
|
||||||
|
{ 4, 165, 101, 53 }, // Music Toggle
|
||||||
|
{ 219, 165, 316, 268 }, // Voice Toggle
|
||||||
|
{ 103, 165, 217, 160 }, // Sound Effects Toggle
|
||||||
|
{ 219, 154, 316, 268 }, // Help Button Left/Right
|
||||||
|
{ 103, 154, 217, 160 }, // New Font Style
|
||||||
|
{ 4, 187, 101, 53 }, // Joystick Toggle
|
||||||
|
{ 103, 187, 217, 160 }, // Calibrate Joystick
|
||||||
|
{ 219, 176, 316, 268 }, // Fade Style
|
||||||
|
{ 103, 176, 217, 160 }, // Window Open Style
|
||||||
|
{ 4, 176, 101, 53 }, // Portraits Toggle
|
||||||
|
{ 219, 187, 316, 268 } // _key Pad Accel. Toggle
|
||||||
|
};
|
||||||
|
|
||||||
|
const char *const SETUP_STRS0[2] = { "off", "on" };
|
||||||
|
const char *const SETUP_STRS1[2] = { "Directly", "by Pixel" };
|
||||||
|
const char *const SETUP_STRS2[2] = { "Left", "Right" };
|
||||||
|
const char *const SETUP_STRS3[2] = { "Appear", "Slide" };
|
||||||
|
const char *const SETUP_STRS4[2] = { "Slow", "Fast" };
|
||||||
|
const char *const SETUP_STRS5[2] = { "Left", "Right" };
|
||||||
|
const char *const SETUP_NAMES[12] = {
|
||||||
|
"Exit", "M", "V", "S", "B", "New Font Style", "J", "Calibrate Joystick", "F", "W", "P", "K"
|
||||||
|
};
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draws the interface for the settings window
|
||||||
|
*/
|
||||||
|
void Settings::drawInteface(bool flag) {
|
||||||
|
People &people = *_vm->_people;
|
||||||
|
Screen &screen = *_vm->_screen;
|
||||||
|
Sound &sound = *_vm->_sound;
|
||||||
|
UserInterface &ui = *_vm->_ui;
|
||||||
|
Common::String tempStr;
|
||||||
|
|
||||||
|
if (!flag) {
|
||||||
|
screen._backBuffer1.fillRect(Common::Rect(0, CONTROLS_Y1, SHERLOCK_SCREEN_WIDTH, CONTROLS_Y1 + 1), BORDER_COLOR);
|
||||||
|
screen._backBuffer1.fillRect(Common::Rect(0, CONTROLS_Y1 + 1, 2, SHERLOCK_SCREEN_HEIGHT), BORDER_COLOR);
|
||||||
|
screen._backBuffer1.fillRect(Common::Rect(SHERLOCK_SCREEN_WIDTH - 2, CONTROLS_Y1 + 1, SHERLOCK_SCREEN_WIDTH,
|
||||||
|
SHERLOCK_SCREEN_HEIGHT), BORDER_COLOR);
|
||||||
|
screen._backBuffer1.hLine(0, SHERLOCK_SCREEN_HEIGHT - 1, SHERLOCK_SCREEN_WIDTH - 1, BORDER_COLOR);
|
||||||
|
screen._backBuffer1.fillRect(Common::Rect(2, CONTROLS_Y1 + 1, SHERLOCK_SCREEN_WIDTH - 2,
|
||||||
|
SHERLOCK_SCREEN_HEIGHT - 2), INV_BACKGROUND);
|
||||||
|
}
|
||||||
|
|
||||||
|
screen.makeButton(Common::Rect(SETUP_POINTS[0][0], SETUP_POINTS[0][1], SETUP_POINTS[0][2], SETUP_POINTS[0][1] + 10),
|
||||||
|
SETUP_POINTS[0][3] - screen.stringWidth("Exit") / 2, "Exit");
|
||||||
|
|
||||||
|
tempStr = Common::String::format("Music %s", SETUP_STRS0[sound._music]);
|
||||||
|
screen.makeButton(Common::Rect(SETUP_POINTS[1][0], SETUP_POINTS[1][1], SETUP_POINTS[1][2], SETUP_POINTS[1][1] + 10),
|
||||||
|
SETUP_POINTS[1][3] - screen.stringWidth(tempStr) / 2, tempStr);
|
||||||
|
|
||||||
|
tempStr = Common::String::format("Voices %s", SETUP_STRS0[sound._voices]);
|
||||||
|
screen.makeButton(Common::Rect(SETUP_POINTS[2][0], SETUP_POINTS[2][1], SETUP_POINTS[2][2], SETUP_POINTS[2][1] + 10),
|
||||||
|
SETUP_POINTS[2][3] - screen.stringWidth(tempStr) / 2, tempStr);
|
||||||
|
|
||||||
|
tempStr = Common::String::format("Sound Effects %s", SETUP_STRS0[sound._digitized]);
|
||||||
|
screen.makeButton(Common::Rect(SETUP_POINTS[3][0], SETUP_POINTS[3][1], SETUP_POINTS[3][2], SETUP_POINTS[3][1] + 10),
|
||||||
|
SETUP_POINTS[3][3] - screen.stringWidth(tempStr) / 2, tempStr);
|
||||||
|
|
||||||
|
tempStr = Common::String::format("Auto Help %s", SETUP_STRS5[ui._helpStyle]);
|
||||||
|
screen.makeButton(Common::Rect(SETUP_POINTS[4][0], SETUP_POINTS[4][1], SETUP_POINTS[4][2], SETUP_POINTS[4][1] + 10),
|
||||||
|
SETUP_POINTS[4][3] - screen.stringWidth(tempStr) / 2, tempStr);
|
||||||
|
screen.makeButton(Common::Rect(SETUP_POINTS[5][0], SETUP_POINTS[5][1], SETUP_POINTS[5][2], SETUP_POINTS[5][1] + 10),
|
||||||
|
SETUP_POINTS[5][3] - screen.stringWidth("New Font Style") / 2, "New Font Style");
|
||||||
|
|
||||||
|
// WORKAROUND: We don't support the joystick in ScummVM, so draw the next two buttons as disabled
|
||||||
|
tempStr = "Joystick Off";
|
||||||
|
screen.makeButton(Common::Rect(SETUP_POINTS[6][0], SETUP_POINTS[6][1], SETUP_POINTS[6][2], SETUP_POINTS[6][1] + 10),
|
||||||
|
SETUP_POINTS[6][3] - screen.stringWidth(tempStr) / 2, tempStr);
|
||||||
|
screen.buttonPrint(Common::Point(SETUP_POINTS[6][3], SETUP_POINTS[6][1]), COMMAND_NULL, false, tempStr);
|
||||||
|
|
||||||
|
tempStr = "Calibrate Joystick";
|
||||||
|
screen.makeButton(Common::Rect(SETUP_POINTS[7][0], SETUP_POINTS[7][1], SETUP_POINTS[7][2], SETUP_POINTS[7][1] + 10),
|
||||||
|
SETUP_POINTS[7][3] - screen.stringWidth(tempStr) / 2, tempStr);
|
||||||
|
screen.buttonPrint(Common::Point(SETUP_POINTS[7][3], SETUP_POINTS[7][1]), COMMAND_NULL, false, tempStr);
|
||||||
|
|
||||||
|
tempStr = Common::String::format("Fade %s", screen._fadeStyle ? "by Pixel" : "Directly");
|
||||||
|
screen.makeButton(Common::Rect(SETUP_POINTS[8][0], SETUP_POINTS[8][1], SETUP_POINTS[8][2], SETUP_POINTS[8][1] + 10),
|
||||||
|
SETUP_POINTS[8][3] - screen.stringWidth(tempStr) / 2, tempStr);
|
||||||
|
|
||||||
|
tempStr = Common::String::format("Windows %s", ui._windowStyle ? "Slide" : "Appear");
|
||||||
|
screen.makeButton(Common::Rect(SETUP_POINTS[9][0], SETUP_POINTS[9][1], SETUP_POINTS[9][2], SETUP_POINTS[9][1] + 10),
|
||||||
|
SETUP_POINTS[9][3] - screen.stringWidth(tempStr) / 2, tempStr);
|
||||||
|
|
||||||
|
tempStr = Common::String::format("Portraits %s", SETUP_STRS0[people._portraitsOn]);
|
||||||
|
screen.makeButton(Common::Rect(SETUP_POINTS[10][0], SETUP_POINTS[10][1], SETUP_POINTS[10][2], SETUP_POINTS[10][1] + 10),
|
||||||
|
SETUP_POINTS[10][3] - screen.stringWidth(tempStr) / 2, tempStr);
|
||||||
|
tempStr = Common::String::format("Key Pad %s", _vm->_keyPadSpeed ? "Fast" : "Slow");
|
||||||
|
|
||||||
|
screen.makeButton(Common::Rect(SETUP_POINTS[11][0], SETUP_POINTS[11][1], SETUP_POINTS[11][2], SETUP_POINTS[11][1] + 10),
|
||||||
|
SETUP_POINTS[11][3] - screen.stringWidth(tempStr) / 2, tempStr);
|
||||||
|
|
||||||
|
// Show the window immediately, or slide it on-screen
|
||||||
|
if (!flag) {
|
||||||
|
if (!ui._windowStyle) {
|
||||||
|
screen.slamRect(Common::Rect(0, CONTROLS_Y1, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT));
|
||||||
|
} else {
|
||||||
|
ui.summonWindow(true, CONTROLS_Y1);
|
||||||
|
}
|
||||||
|
|
||||||
|
ui._windowOpen = true;
|
||||||
|
} else {
|
||||||
|
screen.slamRect(Common::Rect(0, CONTROLS_Y1, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draws the buttons for the settings dialog
|
||||||
|
*/
|
||||||
|
int Settings::drawButtons(const Common::Point &pt, int _key) {
|
||||||
|
Events &events = *_vm->_events;
|
||||||
|
People &people = *_vm->_people;
|
||||||
|
Screen &screen = *_vm->_screen;
|
||||||
|
Sound &sound = *_vm->_sound;
|
||||||
|
UserInterface &ui = *_vm->_ui;
|
||||||
|
int found = -1;
|
||||||
|
byte color;
|
||||||
|
Common::String tempStr;
|
||||||
|
|
||||||
|
for (int idx = 0; idx < 12; ++idx) {
|
||||||
|
if ((pt.x > SETUP_POINTS[idx][0] && pt.x < SETUP_POINTS[idx][2] && pt.y > SETUP_POINTS[idx][1]
|
||||||
|
&& pt.y < (SETUP_POINTS[idx][1] + 10) && (events._released || events._released))
|
||||||
|
|| (_key == SETUP_NAMES[idx][0])) {
|
||||||
|
found = idx;
|
||||||
|
color = COMMAND_HIGHLIGHTED;
|
||||||
|
} else {
|
||||||
|
color = COMMAND_FOREGROUND;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Print the button text
|
||||||
|
switch (idx) {
|
||||||
|
case 1:
|
||||||
|
tempStr = Common::String::format("Music %s", SETUP_STRS0[sound._music]);
|
||||||
|
screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), color, true, tempStr);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
tempStr = Common::String::format("Voices %s", SETUP_STRS0[sound._voices]);
|
||||||
|
screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), color, true, tempStr);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
tempStr = Common::String::format("Sound Effects %s", SETUP_STRS0[sound._digitized]);
|
||||||
|
screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), color, true, tempStr);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
tempStr = Common::String::format("Auto Help %s", SETUP_STRS2[ui._helpStyle]);
|
||||||
|
screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), color, true, tempStr);
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
tempStr = "Joystick Off";
|
||||||
|
screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), COMMAND_NULL, true, tempStr);
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
tempStr = "Calibrate Joystick";
|
||||||
|
screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), COMMAND_NULL, true, tempStr);
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
tempStr = Common::String::format("Fade %s", SETUP_STRS1[screen._fadeStyle]);
|
||||||
|
screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), color, true, tempStr);
|
||||||
|
break;
|
||||||
|
case 9:
|
||||||
|
tempStr = Common::String::format("Windows %s", SETUP_STRS3[ui._windowStyle]);
|
||||||
|
screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), color, true, tempStr);
|
||||||
|
break;
|
||||||
|
case 10:
|
||||||
|
tempStr = Common::String::format("Portraits %s", SETUP_STRS0[people._portraitsOn]);
|
||||||
|
screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), color, true, tempStr);
|
||||||
|
break;
|
||||||
|
case 11:
|
||||||
|
tempStr = Common::String::format("Key Pad %s", SETUP_STRS4[_vm->_keyPadSpeed]);
|
||||||
|
screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), color, true, tempStr);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), color, true, SETUP_NAMES[idx]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // End of namespace Sherlock
|
45
engines/sherlock/settings.h
Normal file
45
engines/sherlock/settings.h
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
/* ScummVM - Graphic Adventure Engine
|
||||||
|
*
|
||||||
|
* ScummVM is the legal property of its developers, whose names
|
||||||
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||||
|
* file distributed with this source distribution.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SHERLOCK_SETTINGS_H
|
||||||
|
#define SHERLOCK_SETTINGS_H
|
||||||
|
|
||||||
|
#include "common/scummsys.h"
|
||||||
|
|
||||||
|
namespace Sherlock {
|
||||||
|
|
||||||
|
class SherlockEngine;
|
||||||
|
|
||||||
|
class Settings {
|
||||||
|
private:
|
||||||
|
SherlockEngine *_vm;
|
||||||
|
public:
|
||||||
|
Settings(SherlockEngine *vm) : _vm(vm) {}
|
||||||
|
|
||||||
|
void drawInteface(bool flag);
|
||||||
|
|
||||||
|
int drawButtons(const Common::Point &pt, int key);
|
||||||
|
};
|
||||||
|
|
||||||
|
} // End of namespace Sherlock
|
||||||
|
|
||||||
|
#endif
|
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
#include "sherlock/user_interface.h"
|
#include "sherlock/user_interface.h"
|
||||||
#include "sherlock/sherlock.h"
|
#include "sherlock/sherlock.h"
|
||||||
|
#include "sherlock/settings.h"
|
||||||
|
|
||||||
namespace Sherlock {
|
namespace Sherlock {
|
||||||
|
|
||||||
|
@ -53,23 +54,6 @@ const int INVENTORY_POINTS[8][3] = {
|
||||||
{ 285, 315, 294 }
|
{ 285, 315, 294 }
|
||||||
};
|
};
|
||||||
|
|
||||||
const int SETUP_POINTS[12][4] = {
|
|
||||||
{ 4, 154, 101, 53 }, // Exit
|
|
||||||
{ 4, 165, 101, 53 }, // Music Toggle
|
|
||||||
{ 219, 165, 316, 268 }, // Voice Toggle
|
|
||||||
{ 103, 165, 217, 160 }, // Sound Effects Toggle
|
|
||||||
{ 219, 154, 316, 268 }, // Help Button Left/Right
|
|
||||||
{ 103, 154, 217, 160 }, // New Font Style
|
|
||||||
{ 4, 187, 101, 53 }, // Joystick Toggle
|
|
||||||
{ 103, 187, 217, 160 }, // Calibrate Joystick
|
|
||||||
{ 219, 176, 316, 268 }, // Fade Style
|
|
||||||
{ 103, 176, 217, 160 }, // Window Open Style
|
|
||||||
{ 4, 176, 101, 53 }, // Portraits Toggle
|
|
||||||
{ 219, 187, 316, 268 } // _key Pad Accel. Toggle
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const char COMMANDS[13] = "LMTPOCIUGJFS";
|
const char COMMANDS[13] = "LMTPOCIUGJFS";
|
||||||
const char INVENTORY_COMMANDS[9] = { "ELUG-+,." };
|
const char INVENTORY_COMMANDS[9] = { "ELUG-+,." };
|
||||||
const char *const PRESS_KEY_FOR_MORE = "Press any Key for More.";
|
const char *const PRESS_KEY_FOR_MORE = "Press any Key for More.";
|
||||||
|
@ -94,174 +78,6 @@ const char *const MUSE[] = {
|
||||||
"Doors don't smoke"
|
"Doors don't smoke"
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *const SETUP_STRS0[2] = { "off", "on" };
|
|
||||||
const char *const SETUP_STRS1[2] = { "Directly", "by Pixel" };
|
|
||||||
const char *const SETUP_STRS2[2] = { "Left", "Right" };
|
|
||||||
const char *const SETUP_STRS3[2] = { "Appear", "Slide" };
|
|
||||||
const char *const SETUP_STRS4[2] = { "Slow", "Fast" };
|
|
||||||
const char *const SETUP_STRS5[2] = { "Left", "Right" };
|
|
||||||
const char *const SETUP_NAMES[12] = {
|
|
||||||
"Exit", "M", "V", "S", "B", "New Font Style", "J", "Calibrate Joystick", "F", "W", "P", "K"
|
|
||||||
};
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Draws the interface for the settings window
|
|
||||||
*/
|
|
||||||
void Settings::drawInteface(bool flag) {
|
|
||||||
People &people = *_vm->_people;
|
|
||||||
Screen &screen = *_vm->_screen;
|
|
||||||
Sound &sound = *_vm->_sound;
|
|
||||||
UserInterface &ui = *_vm->_ui;
|
|
||||||
Common::String tempStr;
|
|
||||||
|
|
||||||
if (!flag) {
|
|
||||||
screen._backBuffer1.fillRect(Common::Rect(0, CONTROLS_Y1, SHERLOCK_SCREEN_WIDTH, CONTROLS_Y1 + 1), BORDER_COLOR);
|
|
||||||
screen._backBuffer1.fillRect(Common::Rect(0, CONTROLS_Y1 + 1, 2, SHERLOCK_SCREEN_HEIGHT), BORDER_COLOR);
|
|
||||||
screen._backBuffer1.fillRect(Common::Rect(SHERLOCK_SCREEN_WIDTH - 2, CONTROLS_Y1 + 1, SHERLOCK_SCREEN_WIDTH,
|
|
||||||
SHERLOCK_SCREEN_HEIGHT), BORDER_COLOR);
|
|
||||||
screen._backBuffer1.hLine(0, SHERLOCK_SCREEN_HEIGHT - 1, SHERLOCK_SCREEN_WIDTH - 1, BORDER_COLOR);
|
|
||||||
screen._backBuffer1.fillRect(Common::Rect(2, CONTROLS_Y1 + 1, SHERLOCK_SCREEN_WIDTH - 2,
|
|
||||||
SHERLOCK_SCREEN_HEIGHT - 2), INV_BACKGROUND);
|
|
||||||
}
|
|
||||||
|
|
||||||
screen.makeButton(Common::Rect(SETUP_POINTS[0][0], SETUP_POINTS[0][1], SETUP_POINTS[0][2], SETUP_POINTS[0][1] + 10),
|
|
||||||
SETUP_POINTS[0][3] - screen.stringWidth("Exit") / 2, "Exit");
|
|
||||||
|
|
||||||
tempStr = Common::String::format("Music %s", SETUP_STRS0[sound._music]);
|
|
||||||
screen.makeButton(Common::Rect(SETUP_POINTS[1][0], SETUP_POINTS[1][1], SETUP_POINTS[1][2], SETUP_POINTS[1][1] + 10),
|
|
||||||
SETUP_POINTS[1][3] - screen.stringWidth(tempStr) / 2, tempStr);
|
|
||||||
|
|
||||||
tempStr = Common::String::format("Voices %s", SETUP_STRS0[sound._voices]);
|
|
||||||
screen.makeButton(Common::Rect(SETUP_POINTS[2][0], SETUP_POINTS[2][1], SETUP_POINTS[2][2], SETUP_POINTS[2][1] + 10),
|
|
||||||
SETUP_POINTS[2][3] - screen.stringWidth(tempStr) / 2, tempStr);
|
|
||||||
|
|
||||||
tempStr = Common::String::format("Sound Effects %s", SETUP_STRS0[sound._digitized]);
|
|
||||||
screen.makeButton(Common::Rect(SETUP_POINTS[3][0], SETUP_POINTS[3][1], SETUP_POINTS[3][2], SETUP_POINTS[3][1] + 10),
|
|
||||||
SETUP_POINTS[3][3] - screen.stringWidth(tempStr) / 2, tempStr);
|
|
||||||
|
|
||||||
tempStr = Common::String::format("Auto Help %s", SETUP_STRS5[ui._helpStyle]);
|
|
||||||
screen.makeButton(Common::Rect(SETUP_POINTS[4][0], SETUP_POINTS[4][1], SETUP_POINTS[4][2], SETUP_POINTS[4][1] + 10),
|
|
||||||
SETUP_POINTS[4][3] - screen.stringWidth(tempStr) / 2, tempStr);
|
|
||||||
screen.makeButton(Common::Rect(SETUP_POINTS[5][0], SETUP_POINTS[5][1], SETUP_POINTS[5][2], SETUP_POINTS[5][1] + 10),
|
|
||||||
SETUP_POINTS[5][3] - screen.stringWidth("New Font Style") / 2, "New Font Style");
|
|
||||||
|
|
||||||
// WORKAROUND: We don't support the joystick in ScummVM, so draw the next two buttons as disabled
|
|
||||||
tempStr = "Joystick Off";
|
|
||||||
screen.makeButton(Common::Rect(SETUP_POINTS[6][0], SETUP_POINTS[6][1], SETUP_POINTS[6][2], SETUP_POINTS[6][1] + 10),
|
|
||||||
SETUP_POINTS[6][3] - screen.stringWidth(tempStr) / 2, tempStr);
|
|
||||||
screen.buttonPrint(Common::Point(SETUP_POINTS[6][3], SETUP_POINTS[6][1]), COMMAND_NULL, false, tempStr);
|
|
||||||
|
|
||||||
tempStr = "Calibrate Joystick";
|
|
||||||
screen.makeButton(Common::Rect(SETUP_POINTS[7][0], SETUP_POINTS[7][1], SETUP_POINTS[7][2], SETUP_POINTS[7][1] + 10),
|
|
||||||
SETUP_POINTS[7][3] - screen.stringWidth(tempStr) / 2, tempStr);
|
|
||||||
screen.buttonPrint(Common::Point(SETUP_POINTS[7][3], SETUP_POINTS[7][1]), COMMAND_NULL, false, tempStr);
|
|
||||||
|
|
||||||
tempStr = Common::String::format("Fade %s", screen._fadeStyle ? "by Pixel" : "Directly");
|
|
||||||
screen.makeButton(Common::Rect(SETUP_POINTS[8][0], SETUP_POINTS[8][1], SETUP_POINTS[8][2], SETUP_POINTS[8][1] + 10),
|
|
||||||
SETUP_POINTS[8][3] - screen.stringWidth(tempStr) / 2, tempStr);
|
|
||||||
|
|
||||||
tempStr = Common::String::format("Windows %s", ui._windowStyle ? "Slide" : "Appear");
|
|
||||||
screen.makeButton(Common::Rect(SETUP_POINTS[9][0], SETUP_POINTS[9][1], SETUP_POINTS[9][2], SETUP_POINTS[9][1] + 10),
|
|
||||||
SETUP_POINTS[9][3] - screen.stringWidth(tempStr) / 2, tempStr);
|
|
||||||
|
|
||||||
tempStr = Common::String::format("Portraits %s", SETUP_STRS0[people._portraitsOn]);
|
|
||||||
screen.makeButton(Common::Rect(SETUP_POINTS[10][0], SETUP_POINTS[10][1], SETUP_POINTS[10][2], SETUP_POINTS[10][1] + 10),
|
|
||||||
SETUP_POINTS[10][3] - screen.stringWidth(tempStr) / 2, tempStr);
|
|
||||||
tempStr = Common::String::format("Key Pad %s", _vm->_keyPadSpeed ? "Fast" : "Slow");
|
|
||||||
|
|
||||||
screen.makeButton(Common::Rect(SETUP_POINTS[11][0], SETUP_POINTS[11][1], SETUP_POINTS[11][2], SETUP_POINTS[11][1] + 10),
|
|
||||||
SETUP_POINTS[11][3] - screen.stringWidth(tempStr) / 2, tempStr);
|
|
||||||
|
|
||||||
// Show the window immediately, or slide it on-screen
|
|
||||||
if (!flag) {
|
|
||||||
if (!ui._windowStyle) {
|
|
||||||
screen.slamRect(Common::Rect(0, CONTROLS_Y1, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT));
|
|
||||||
} else {
|
|
||||||
ui.summonWindow(true, CONTROLS_Y1);
|
|
||||||
}
|
|
||||||
|
|
||||||
ui._windowOpen = true;
|
|
||||||
} else {
|
|
||||||
screen.slamRect(Common::Rect(0, CONTROLS_Y1, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Draws the buttons for the settings dialog
|
|
||||||
*/
|
|
||||||
int Settings::drawButtons(const Common::Point &pt, int _key) {
|
|
||||||
Events &events = *_vm->_events;
|
|
||||||
People &people = *_vm->_people;
|
|
||||||
Screen &screen = *_vm->_screen;
|
|
||||||
Sound &sound = *_vm->_sound;
|
|
||||||
UserInterface &ui = *_vm->_ui;
|
|
||||||
int found = -1;
|
|
||||||
byte color;
|
|
||||||
Common::String tempStr;
|
|
||||||
|
|
||||||
for (int idx = 0; idx < 12; ++idx) {
|
|
||||||
if ((pt.x > SETUP_POINTS[idx][0] && pt.x < SETUP_POINTS[idx][2] && pt.y > SETUP_POINTS[idx][1]
|
|
||||||
&& pt.y < (SETUP_POINTS[idx][1] + 10) && (events._released || events._released))
|
|
||||||
|| (_key == SETUP_NAMES[idx][0])) {
|
|
||||||
found = idx;
|
|
||||||
color = COMMAND_HIGHLIGHTED;
|
|
||||||
} else {
|
|
||||||
color = COMMAND_FOREGROUND;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Print the button text
|
|
||||||
switch (idx) {
|
|
||||||
case 1:
|
|
||||||
tempStr = Common::String::format("Music %s", SETUP_STRS0[sound._music]);
|
|
||||||
screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), color, true, tempStr);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
tempStr = Common::String::format("Voices %s", SETUP_STRS0[sound._voices]);
|
|
||||||
screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), color, true, tempStr);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
tempStr = Common::String::format("Sound Effects %s", SETUP_STRS0[sound._digitized]);
|
|
||||||
screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), color, true, tempStr);
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
tempStr = Common::String::format("Auto Help %s", SETUP_STRS2[ui._helpStyle]);
|
|
||||||
screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), color, true, tempStr);
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
tempStr = "Joystick Off";
|
|
||||||
screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), COMMAND_NULL, true, tempStr);
|
|
||||||
break;
|
|
||||||
case 7:
|
|
||||||
tempStr = "Calibrate Joystick";
|
|
||||||
screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), COMMAND_NULL, true, tempStr);
|
|
||||||
break;
|
|
||||||
case 8:
|
|
||||||
tempStr = Common::String::format("Fade %s", SETUP_STRS1[screen._fadeStyle]);
|
|
||||||
screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), color, true, tempStr);
|
|
||||||
break;
|
|
||||||
case 9:
|
|
||||||
tempStr = Common::String::format("Windows %s", SETUP_STRS3[ui._windowStyle]);
|
|
||||||
screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), color, true, tempStr);
|
|
||||||
break;
|
|
||||||
case 10:
|
|
||||||
tempStr = Common::String::format("Portraits %s", SETUP_STRS0[people._portraitsOn]);
|
|
||||||
screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), color, true, tempStr);
|
|
||||||
break;
|
|
||||||
case 11:
|
|
||||||
tempStr = Common::String::format("Key Pad %s", SETUP_STRS4[_vm->_keyPadSpeed]);
|
|
||||||
screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), color, true, tempStr);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), color, true, SETUP_NAMES[idx]);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return found;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------*/
|
/*----------------------------------------------------------------*/
|
||||||
|
|
||||||
UserInterface::UserInterface(SherlockEngine *vm) : _vm(vm) {
|
UserInterface::UserInterface(SherlockEngine *vm) : _vm(vm) {
|
||||||
|
|
|
@ -63,17 +63,6 @@ class Inventory;
|
||||||
class Talk;
|
class Talk;
|
||||||
class UserInterface;
|
class UserInterface;
|
||||||
|
|
||||||
class Settings {
|
|
||||||
private:
|
|
||||||
SherlockEngine *_vm;
|
|
||||||
public:
|
|
||||||
Settings(SherlockEngine *vm) : _vm(vm) {}
|
|
||||||
|
|
||||||
void drawInteface(bool flag);
|
|
||||||
|
|
||||||
int drawButtons(const Common::Point &pt, int key);
|
|
||||||
};
|
|
||||||
|
|
||||||
class UserInterface {
|
class UserInterface {
|
||||||
friend class Inventory;
|
friend class Inventory;
|
||||||
friend class Settings;
|
friend class Settings;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue