Skip to content

Commit

Permalink
SHERLOCK: Fix Setup dialog button handling
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Apr 21, 2015
1 parent 6d2bde3 commit a81686b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
1 change: 0 additions & 1 deletion engines/sherlock/sherlock.h
Expand Up @@ -105,7 +105,6 @@ class SherlockEngine : public Engine {
Common::Point _over; // Old map position
bool _onChessboard;
bool _slowChess;
bool _joystick;
int _keyPadSpeed;
public:
SherlockEngine(OSystem *syst, const SherlockGameDescription *gameDesc);
Expand Down
18 changes: 11 additions & 7 deletions engines/sherlock/user_interface.cpp
Expand Up @@ -146,7 +146,8 @@ void Settings::drawInteface(bool flag) {
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");
tempStr = Common::String::format("Joystick %s", SETUP_STRS0[_vm->_joystick ? 1 : 0]);

tempStr = Common::String::format("Joystick %s", SETUP_STRS0[0]);
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.makeButton(Common::Rect(SETUP_POINTS[7][0], SETUP_POINTS[7][1], SETUP_POINTS[7][2], SETUP_POINTS[7][1] + 10),
Expand Down Expand Up @@ -221,7 +222,7 @@ int Settings::drawButtons(const Common::Point &pt, int key) {
screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), color, true, tempStr);
break;
case 6:
tempStr = Common::String::format("Joystick %s", SETUP_STRS0[_vm->_joystick]);
tempStr = Common::String::format("Joystick %s", SETUP_STRS0[0]);
screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), color, true, tempStr);
break;
case 8:
Expand Down Expand Up @@ -1793,16 +1794,19 @@ void UserInterface::doControls() {

if ((found == 5 && events._released) || _key == 'N') {
// New font style
screen.setFont((screen.fontNumber() + 1) & 3);
}
int fontNum = screen.fontNumber() + 1;
if (fontNum == 3)
fontNum = 0;

if ((found == 6 && events._released) || _key == 'J') {
// Toggle joystick
_vm->_joystick = !_vm->_joystick;
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
}
Expand Down
2 changes: 1 addition & 1 deletion engines/sherlock/user_interface.h
Expand Up @@ -67,7 +67,7 @@ class Settings {
private:
SherlockEngine *_vm;
public:
Settings(SherlockEngine *vm) : _vm() {}
Settings(SherlockEngine *vm) : _vm(vm) {}

void drawInteface(bool flag);

Expand Down

0 comments on commit a81686b

Please sign in to comment.