Skip to content

Commit

Permalink
SHERLOCK: RT: Fixes for Foolscap puzzle
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Aug 2, 2015
1 parent 6a21765 commit 6a346b9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
15 changes: 9 additions & 6 deletions engines/sherlock/tattoo/widget_foolscap.cpp
Expand Up @@ -107,12 +107,15 @@ void WidgetFoolscap::show() {
if (_vm->readFlags(299)) {
Common::Point cursorPos;
for (int line = 0; line < 3; ++line) {
cursorPos.y = _lines[_lineNum].y - screen.fontHeight() - 2;
cursorPos.y = _lines[line].y - screen.fontHeight() - 2;

for (uint idx = 0; idx < strlen(_solutions[_lineNum]); ++idx) {
cursorPos.x = _lines[_lineNum].x + 8 - screen.widestChar() / 2 + idx * _spacing;
screen.gPrint(Common::Point(cursorPos.x + screen.widestChar() / 2 -
screen.charWidth(_solutions[_lineNum][idx]) / 2, cursorPos.y), 0, "%c", _solutions[_lineNum][idx]);
for (uint idx = 0; idx < strlen(_solutions[line]); ++idx) {
cursorPos.x = _lines[line].x + 8 - screen.widestChar() / 2 + idx * _spacing;
char c = _solutions[line][idx];

Common::String str = Common::String::format("%c", c);
_surface.writeString(str, Common::Point(cursorPos.x + screen.widestChar() / 2
- screen.charWidth(c) / 2, cursorPos.y), 0);
}
}
}
Expand Down Expand Up @@ -253,7 +256,7 @@ void WidgetFoolscap::handleKeyboardEvents() {
// See if all of their anwers are correct
if (!scumm_stricmp(_answers[0], _solutions[0]) && !scumm_stricmp(_answers[1], _solutions[1])
&& !scumm_stricmp(_answers[2], _solutions[2])) {
_solved;
_solved = true;
close();
}
}
Expand Down
2 changes: 1 addition & 1 deletion engines/sherlock/tattoo/widget_foolscap.h
Expand Up @@ -60,7 +60,7 @@ class WidgetFoolscap: public WidgetBase {
virtual ~WidgetFoolscap();

/**
* Show the hangman puzzle
* Show the foolscap puzzle
*/
void show();

Expand Down
11 changes: 4 additions & 7 deletions engines/sherlock/tattoo/widget_inventory.cpp
Expand Up @@ -390,23 +390,20 @@ void WidgetInventoryVerbs::handleEvents() {
_outsideMenu = false;

// Check if they are trying to solve the Foolscap puzzle, or looking at the completed puzzle
bool doHangman = !inv[_owner->_invSelect]._name.compareToIgnoreCase(FIXED(Inv6)) &&
bool doFoolscap = !inv[_owner->_invSelect]._name.compareToIgnoreCase(FIXED(Inv6)) &&
!_inventCommands[_invVerbSelect].compareToIgnoreCase(FIXED(Solve));
doHangman |= (!inv[_owner->_invSelect]._name.compareToIgnoreCase(FIXED(Inv6)) || !inv[_owner->_invSelect]._name.compareToIgnoreCase(FIXED(Inv7)))
doFoolscap |= (!inv[_owner->_invSelect]._name.compareToIgnoreCase(FIXED(Inv6)) || !inv[_owner->_invSelect]._name.compareToIgnoreCase(FIXED(Inv7)))
&& _inventCommands[_invVerbSelect].compareToIgnoreCase(FIXED(Look)) && vm.readFlags(299);

if (doHangman) {
if (doFoolscap) {
// Close the entire Inventory and return to Standard Mode
_owner->_invVerbMode = 0;

_owner->_tooltipWidget.banishWindow();
_owner->banishWindow();
inv.freeInv();

events.clearEvents();
events.setCursor(ARROW);
ui._menuMode = scene._labTableScene ? LAB_MODE : STD_MODE;

scene.doBgAnim();
vm.doFoolscapPuzzle();
} else if (_invVerbSelect == 0) {
// They have released the mouse on the Look Verb command, so Look at the inventory item
Expand Down

0 comments on commit 6a346b9

Please sign in to comment.