[Scummvm-cvs-logs] scummvm master -> 6a21765c2e252f58795e777308079cf93918a4ef

dreammaster dreammaster at scummvm.org
Sun Aug 2 23:49:40 CEST 2015


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
6a21765c2e SHERLOCK: RT: Rename hangman puzzle to foolscap puzzle


Commit: 6a21765c2e252f58795e777308079cf93918a4ef
    https://github.com/scummvm/scummvm/commit/6a21765c2e252f58795e777308079cf93918a4ef
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2015-08-02T17:47:44-04:00

Commit Message:
SHERLOCK: RT: Rename hangman puzzle to foolscap puzzle

Changed paths:
  A engines/sherlock/tattoo/widget_foolscap.cpp
  A engines/sherlock/tattoo/widget_foolscap.h
  R engines/sherlock/tattoo/widget_hangman.cpp
  R engines/sherlock/tattoo/widget_hangman.h
    engines/sherlock/module.mk
    engines/sherlock/tattoo/tattoo.cpp
    engines/sherlock/tattoo/tattoo.h
    engines/sherlock/tattoo/widget_inventory.cpp



diff --git a/engines/sherlock/module.mk b/engines/sherlock/module.mk
index c602021..e58a2a1 100644
--- a/engines/sherlock/module.mk
+++ b/engines/sherlock/module.mk
@@ -35,7 +35,7 @@ MODULE_OBJS = \
 	tattoo/widget_base.o \
 	tattoo/widget_credits.o \
 	tattoo/widget_files.o \
-	tattoo/widget_hangman.o \
+	tattoo/widget_foolscap.o \
 	tattoo/widget_inventory.o \
 	tattoo/widget_lab.o \
 	tattoo/widget_options.o \
diff --git a/engines/sherlock/tattoo/tattoo.cpp b/engines/sherlock/tattoo/tattoo.cpp
index 110d13b..889a042 100644
--- a/engines/sherlock/tattoo/tattoo.cpp
+++ b/engines/sherlock/tattoo/tattoo.cpp
@@ -35,7 +35,7 @@ namespace Sherlock {
 namespace Tattoo {
 
 TattooEngine::TattooEngine(OSystem *syst, const SherlockGameDescription *gameDesc) :
-		SherlockEngine(syst, gameDesc), _darts(this), _hangmanWidget(this) {
+		SherlockEngine(syst, gameDesc), _darts(this), _foolscapWidget(this) {
 	_runningProlog = false;
 	_fastMode = false;
 	_allowFastMode = true;
@@ -175,8 +175,8 @@ void TattooEngine::loadInventory() {
 	inv.push_back(InventoryItem(818, inv8, invDesc8, "_LANT02I"));
 }
 
-void TattooEngine::doHangManPuzzle() {
-	_hangmanWidget.show();
+void TattooEngine::doFoolscapPuzzle() {
+	_foolscapWidget.show();
 }
 
 void TattooEngine::loadConfig() {
diff --git a/engines/sherlock/tattoo/tattoo.h b/engines/sherlock/tattoo/tattoo.h
index 8a19746..022a0ad 100644
--- a/engines/sherlock/tattoo/tattoo.h
+++ b/engines/sherlock/tattoo/tattoo.h
@@ -25,7 +25,7 @@
 
 #include "sherlock/sherlock.h"
 #include "sherlock/tattoo/tattoo_darts.h"
-#include "sherlock/tattoo/widget_hangman.h"
+#include "sherlock/tattoo/widget_foolscap.h"
 
 namespace Sherlock {
 
@@ -55,7 +55,7 @@ enum {
 class TattooEngine : public SherlockEngine {
 private:
 	Darts _darts;
-	WidgetHangman _hangmanWidget;
+	WidgetFoolscap _foolscapWidget;
 
 	/**
 	 * Loads the initial palette for the game
@@ -93,9 +93,9 @@ public:
 	virtual ~TattooEngine();
 
 	/**
-	 * Shows the hangman puzzle
+	 * Shows the foolscap puzzle
 	 */
-	void doHangManPuzzle();
+	void doFoolscapPuzzle();
 
 	/**
 	 * Save the game configuration
diff --git a/engines/sherlock/tattoo/widget_foolscap.cpp b/engines/sherlock/tattoo/widget_foolscap.cpp
new file mode 100644
index 0000000..9b906ae
--- /dev/null
+++ b/engines/sherlock/tattoo/widget_foolscap.cpp
@@ -0,0 +1,294 @@
+/* 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/tattoo/widget_foolscap.h"
+#include "sherlock/tattoo/tattoo_fixed_text.h"
+#include "sherlock/tattoo/tattoo_scene.h"
+#include "sherlock/tattoo/tattoo_user_interface.h"
+#include "sherlock/tattoo/tattoo.h"
+
+namespace Sherlock {
+
+namespace Tattoo {
+
+WidgetFoolscap::WidgetFoolscap(TattooEngine *vm) : WidgetBase(vm) {
+	for (int idx = 0; idx < 3; ++idx)
+		Common::fill(&_answers[idx][0], &_answers[idx][10], 0);
+	_images = nullptr;
+	_numWide = 0;
+	_spacing = 0;
+	_blinkFlag = false;
+	_blinkCounter = 0;
+	_lineNum = _charNum = 0;
+	_solved = false;
+}
+
+WidgetFoolscap::~WidgetFoolscap() {
+	delete _images;
+}
+
+void WidgetFoolscap::show() {
+	Screen &screen = *_vm->_screen;
+	TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui;
+
+	switch (_vm->getLanguage()) {
+	case Common::FR_FRA:
+		_lines[0] = Common::Point(34, 210);
+		_lines[1] = Common::Point(72, 242);
+		_lines[2] = Common::Point(34, 276);
+		_numWide = 8;
+		_spacing = 19;
+		_images = new ImageFile("paperf.vgs");
+		break;
+
+	case Common::DE_DEU:
+		_lines[0] = Common::Point(44, 73);
+		_lines[1] = Common::Point(56, 169);
+		_lines[2] = Common::Point(47, 256);
+		_numWide = 7;
+		_spacing = 19;
+		_images = new ImageFile("paperg.vgs");
+		break;
+
+	default:
+		// English
+		_lines[0] = Common::Point(65, 84);
+		_lines[1] = Common::Point(65, 159);
+		_lines[2] = Common::Point(75, 234);
+		_numWide = 5;
+		_spacing = 20;
+		_images = new ImageFile("paper.vgs");
+		break;
+	}
+
+	_solved = false;
+	_blinkFlag = false;
+	_blinkCounter = 0;
+	_lineNum = _charNum = 0;
+	_cursorPos = Common::Point(_lines[0].x + 8 - screen.widestChar() / 2, _lines[0].y - screen.fontHeight() - 2);
+
+	// Set up window bounds
+	ImageFrame &paperFrame = (*_images)[0];
+	_bounds = Common::Rect(paperFrame._width, paperFrame._height);
+	_bounds.moveTo(screen._currentScroll.x + (SHERLOCK_SCREEN_WIDTH - paperFrame._width) / 2,
+		(SHERLOCK_SCREEN_HEIGHT - paperFrame._height) / 2);
+
+	// Clear answer data and set correct solution strings
+	for (int idx = 0; idx < 3; ++idx)
+		Common::fill(&_answers[idx][0], &_answers[idx][10], 0);
+	_solutions[0] = FIXED(Apply);
+	_solutions[1] = FIXED(Water);
+	_solutions[2] = FIXED(Heat);
+
+	// Set up the window background
+	_surface.create(_bounds.width(), _bounds.height());
+	_surface.blitFrom(paperFrame, Common::Point(0, 0));
+
+	// If they have already solved the puzzle, put the answer on the graphic
+	if (_vm->readFlags(299)) {
+		Common::Point cursorPos;
+		for (int line = 0; line < 3; ++line) {
+			cursorPos.y = _lines[_lineNum].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]);
+			}
+		}
+	}
+
+	// Show the window
+	summonWindow();
+	ui._menuMode = FOOLSCAP_MODE;
+} 
+
+void WidgetFoolscap::handleEvents() {
+	Events &events = *_vm->_events;
+	Screen &screen = *_vm->_screen;
+	TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui;
+	Common::Point mousePos = events.mousePos();
+	byte cursorColor = 254;
+
+	if (events._firstPress && !_bounds.contains(mousePos))
+		_outsideMenu = true;
+
+	// If they have not solved the puzzle, let them solve it here
+	if (!_vm->readFlags(299)) {
+		if (!ui._keyState.keycode) {
+			if (--_blinkCounter < 0) {
+				_blinkCounter = 3;
+				_blinkFlag = !_blinkFlag;
+
+				if (_blinkFlag) {
+					// Draw the caret
+					_surface.fillRect(Common::Rect(_cursorPos.x, _cursorPos.y, _cursorPos.x + screen.widestChar() - 1,
+						_cursorPos.y + screen.fontHeight() - 1), cursorColor);
+
+					if (_answers[_lineNum][_charNum]) {
+						Common::String str = Common::String::format("%c", _answers[_lineNum][_charNum]);
+						_surface.writeString(str, Common::Point(_cursorPos.x + screen.widestChar() / 2
+							- screen.charWidth(_answers[_lineNum][_charNum]) / 2, _cursorPos.y), 0);
+					}
+				} else {
+					// Restore background
+					restoreChar();
+
+					// Draw the character at that position if there is one
+					if (_answers[_lineNum][_charNum]) {
+						Common::String str = Common::String::format("%c", _answers[_lineNum][_charNum]);
+						_surface.writeString(str, Common::Point(_cursorPos.x + screen.widestChar() / 2
+							- screen.charWidth(_answers[_lineNum][_charNum]) / 2, _cursorPos.y), 0);
+					}
+				}
+			}
+		} else {
+			// Handle keyboard events
+			handleKeyboardEvents();
+		}
+	}
+
+	if ((events._released || events._rightReleased) && _outsideMenu && !_bounds.contains(mousePos)) {
+		// Clicked outside window to close it
+		events.clearEvents();
+		close();
+	}
+}
+
+void WidgetFoolscap::handleKeyboardEvents() {
+	Screen &screen = *_vm->_screen;
+	TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui;
+	Common::KeyState keyState = ui._keyState;
+
+	if (((toupper(keyState.ascii) >= 'A') && (toupper(keyState.ascii) <= 'Z')) ||
+		((keyState.ascii >= 128) && ((keyState.ascii <= 168) || (keyState.ascii == 225)))) {
+		// Visible key pressed, set it and set the keycode to move the caret to the right
+		_answers[_lineNum][_charNum] = keyState.ascii;
+		keyState.keycode = Common::KEYCODE_RIGHT;
+	}
+
+	// Restore background
+	restoreChar();
+
+	if (_answers[_lineNum][_charNum]) {
+		Common::String str = Common::String::format("%c", _answers[_lineNum][_charNum]);
+		_surface.writeString(str, Common::Point(_cursorPos.x + screen.widestChar() / 2
+			- screen.charWidth(_answers[_lineNum][_charNum]) / 2, _cursorPos.y), 0);
+	}
+
+	switch (keyState.keycode) {
+	case Common::KEYCODE_ESCAPE:
+		close();
+		break;
+
+	case Common::KEYCODE_UP:
+		if (_lineNum) {
+			--_lineNum;
+			if (_charNum >= (int)strlen(_solutions[_lineNum]))
+				_charNum = (int)strlen(_solutions[_lineNum]) - 1;
+		}
+		break;
+
+	case Common::KEYCODE_DOWN:
+		if (_lineNum < 2) {
+			++_lineNum;
+			if (_charNum >= (int)strlen(_solutions[_lineNum]))
+				_charNum = (int)strlen(_solutions[_lineNum]) - 1;
+		}
+		break;
+
+	case Common::KEYCODE_BACKSPACE:
+	case Common::KEYCODE_LEFT:
+		if (_charNum)
+			--_charNum;
+		else if (_lineNum) {
+			--_lineNum;
+
+			_charNum = strlen(_solutions[_lineNum]) - 1;
+		}
+
+		if (keyState.keycode == Common::KEYCODE_BACKSPACE)
+			_answers[_lineNum][_charNum] = ' ';
+		break;
+
+	case Common::KEYCODE_RIGHT:
+		if (_charNum < (int)strlen(_solutions[_lineNum]) - 1)
+			++_charNum;
+		else if (_lineNum < 2) {
+			++_lineNum;
+			_charNum = 0;
+		}
+		break;
+
+	case Common::KEYCODE_DELETE:
+		_answers[_lineNum][_charNum] = ' ';
+		break;
+
+	default:
+		break;
+	}
+
+	_cursorPos.x = _lines[_lineNum].x + 8 - screen.widestChar() / 2 + _charNum * _spacing;
+	_cursorPos.y = _lines[_lineNum].y - screen.fontHeight() - 2;
+
+	// 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;
+		close();
+	}
+}
+
+void WidgetFoolscap::restoreChar() {
+	Screen &screen = *_vm->_screen;
+	ImageFrame &bgFrame = (*_images)[0];
+	_surface.blitFrom(bgFrame, _cursorPos, Common::Rect(_cursorPos.x, _cursorPos.y,
+		_cursorPos.x + screen.widestChar(), _cursorPos.y + screen.fontHeight()));
+}
+
+void WidgetFoolscap::close() {
+	TattooScene &scene = *(TattooScene *)_vm->_scene;
+	Talk &talk = *_vm->_talk;
+	TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui;
+	delete _images;
+	_images = nullptr;
+
+	// Close the window
+	banishWindow();
+	ui._menuMode = scene._labTableScene ? LAB_MODE : STD_MODE;
+
+	// Don't call the talk files if the puzzle has already been solved
+	if (!_vm->readFlags(299)) {
+		// Run the appropriate script depending on whether or not they solved the puzzle correctly
+		if (_solved) {
+			talk.talkTo("SLVE12S.TLK");
+			talk.talkTo("WATS12X.TLK");
+			_vm->setFlags(299);
+		} else {
+			talk.talkTo("HOLM12X.TLK");
+		}
+	}
+}
+
+} // End of namespace Tattoo
+
+} // End of namespace Sherlock
diff --git a/engines/sherlock/tattoo/widget_foolscap.h b/engines/sherlock/tattoo/widget_foolscap.h
new file mode 100644
index 0000000..5ed1ede
--- /dev/null
+++ b/engines/sherlock/tattoo/widget_foolscap.h
@@ -0,0 +1,82 @@
+/* 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_TATTOO_FOOLSCAP_H
+#define SHERLOCK_TATTOO_FOOLSCAP_H
+
+#include "sherlock/tattoo/widget_base.h"
+#include "sherlock/image_file.h"
+
+namespace Sherlock {
+
+namespace Tattoo {
+
+class TattooEngine;
+
+class WidgetFoolscap: public WidgetBase {
+private:
+	ImageFile *_images;
+	Common::Point _lines[3];
+	char _answers[3][10];
+	const char *_solutions[3];
+	int _numWide;
+	int _spacing;
+	Common::Point _cursorPos;
+	int _blinkCounter;
+	bool _blinkFlag;
+	int _lineNum, _charNum;
+	bool _solved;
+
+	/**
+	 * Handle keyboard events
+	 */
+	void handleKeyboardEvents();
+
+	/**
+	 * Restore the background for the current line/horiz position
+	 */
+	void restoreChar();
+public:
+	WidgetFoolscap(TattooEngine *vm);
+	virtual ~WidgetFoolscap();
+
+	/**
+	 * Show the hangman puzzle
+	 */
+	void show();
+
+	/**
+	 * Close the window
+	 */
+	void close();
+
+	/**
+	* Handle events whilst the widget is on-screen
+	*/
+	virtual void handleEvents();
+};
+
+} // End of namespace Tattoo
+
+} // End of namespace Sherlock
+
+#endif
diff --git a/engines/sherlock/tattoo/widget_hangman.cpp b/engines/sherlock/tattoo/widget_hangman.cpp
deleted file mode 100644
index f41c5e4..0000000
--- a/engines/sherlock/tattoo/widget_hangman.cpp
+++ /dev/null
@@ -1,294 +0,0 @@
-/* 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/tattoo/widget_hangman.h"
-#include "sherlock/tattoo/tattoo_fixed_text.h"
-#include "sherlock/tattoo/tattoo_scene.h"
-#include "sherlock/tattoo/tattoo_user_interface.h"
-#include "sherlock/tattoo/tattoo.h"
-
-namespace Sherlock {
-
-namespace Tattoo {
-
-WidgetHangman::WidgetHangman(TattooEngine *vm) : WidgetBase(vm) {
-	for (int idx = 0; idx < 3; ++idx)
-		Common::fill(&_answers[idx][0], &_answers[idx][10], 0);
-	_images = nullptr;
-	_numWide = 0;
-	_spacing = 0;
-	_blinkFlag = false;
-	_blinkCounter = 0;
-	_lineNum = _charNum = 0;
-	_solved = false;
-}
-
-WidgetHangman::~WidgetHangman() {
-	delete _images;
-}
-
-void WidgetHangman::show() {
-	Screen &screen = *_vm->_screen;
-	TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui;
-
-	switch (_vm->getLanguage()) {
-	case Common::FR_FRA:
-		_lines[0] = Common::Point(34, 210);
-		_lines[1] = Common::Point(72, 242);
-		_lines[2] = Common::Point(34, 276);
-		_numWide = 8;
-		_spacing = 19;
-		_images = new ImageFile("paperf.vgs");
-		break;
-
-	case Common::DE_DEU:
-		_lines[0] = Common::Point(44, 73);
-		_lines[1] = Common::Point(56, 169);
-		_lines[2] = Common::Point(47, 256);
-		_numWide = 7;
-		_spacing = 19;
-		_images = new ImageFile("paperg.vgs");
-		break;
-
-	default:
-		// English
-		_lines[0] = Common::Point(65, 84);
-		_lines[1] = Common::Point(65, 159);
-		_lines[2] = Common::Point(75, 234);
-		_numWide = 5;
-		_spacing = 20;
-		_images = new ImageFile("paper.vgs");
-		break;
-	}
-
-	_solved = false;
-	_blinkFlag = false;
-	_blinkCounter = 0;
-	_lineNum = _charNum = 0;
-	_cursorPos = Common::Point(_lines[0].x + 8 - screen.widestChar() / 2, _lines[0].y - screen.fontHeight() - 2);
-
-	// Set up window bounds
-	ImageFrame &paperFrame = (*_images)[0];
-	_bounds = Common::Rect(paperFrame._width, paperFrame._height);
-	_bounds.moveTo(screen._currentScroll.x + (SHERLOCK_SCREEN_WIDTH - paperFrame._width) / 2,
-		(SHERLOCK_SCREEN_HEIGHT - paperFrame._height) / 2);
-
-	// Clear answer data and set correct solution strings
-	for (int idx = 0; idx < 3; ++idx)
-		Common::fill(&_answers[idx][0], &_answers[idx][10], 0);
-	_solutions[0] = FIXED(Apply);
-	_solutions[1] = FIXED(Water);
-	_solutions[2] = FIXED(Heat);
-
-	// Set up the window background
-	_surface.create(_bounds.width(), _bounds.height());
-	_surface.blitFrom(paperFrame, Common::Point(0, 0));
-
-	// If they have already solved the puzzle, put the answer on the graphic
-	if (_vm->readFlags(299)) {
-		Common::Point cursorPos;
-		for (int line = 0; line < 3; ++line) {
-			cursorPos.y = _lines[_lineNum].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]);
-			}
-		}
-	}
-
-	// Show the window
-	summonWindow();
-	ui._menuMode = FOOLSCAP_MODE;
-} 
-
-void WidgetHangman::handleEvents() {
-	Events &events = *_vm->_events;
-	Screen &screen = *_vm->_screen;
-	TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui;
-	Common::Point mousePos = events.mousePos();
-	byte cursorColor = 254;
-
-	if (events._firstPress && !_bounds.contains(mousePos))
-		_outsideMenu = true;
-
-	// If they have not solved the puzzle, let them solve it here
-	if (!_vm->readFlags(299)) {
-		if (!ui._keyState.keycode) {
-			if (--_blinkCounter < 0) {
-				_blinkCounter = 3;
-				_blinkFlag = !_blinkFlag;
-
-				if (_blinkFlag) {
-					// Draw the caret
-					_surface.fillRect(Common::Rect(_cursorPos.x, _cursorPos.y, _cursorPos.x + screen.widestChar() - 1,
-						_cursorPos.y + screen.fontHeight() - 1), cursorColor);
-
-					if (_answers[_lineNum][_charNum]) {
-						Common::String str = Common::String::format("%c", _answers[_lineNum][_charNum]);
-						_surface.writeString(str, Common::Point(_cursorPos.x + screen.widestChar() / 2
-							- screen.charWidth(_answers[_lineNum][_charNum]) / 2, _cursorPos.y), 0);
-					}
-				} else {
-					// Restore background
-					restoreChar();
-
-					// Draw the character at that position if there is one
-					if (_answers[_lineNum][_charNum]) {
-						Common::String str = Common::String::format("%c", _answers[_lineNum][_charNum]);
-						_surface.writeString(str, Common::Point(_cursorPos.x + screen.widestChar() / 2
-							- screen.charWidth(_answers[_lineNum][_charNum]) / 2, _cursorPos.y), 0);
-					}
-				}
-			}
-		} else {
-			// Handle keyboard events
-			handleKeyboardEvents();
-		}
-	}
-
-	if ((events._released || events._rightReleased) && _outsideMenu && !_bounds.contains(mousePos)) {
-		// Clicked outside window to close it
-		events.clearEvents();
-		close();
-	}
-}
-
-void WidgetHangman::handleKeyboardEvents() {
-	Screen &screen = *_vm->_screen;
-	TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui;
-	Common::KeyState keyState = ui._keyState;
-
-	if (((toupper(keyState.ascii) >= 'A') && (toupper(keyState.ascii) <= 'Z')) ||
-		((keyState.ascii >= 128) && ((keyState.ascii <= 168) || (keyState.ascii == 225)))) {
-		// Visible key pressed, set it and set the keycode to move the caret to the right
-		_answers[_lineNum][_charNum] = keyState.ascii;
-		keyState.keycode = Common::KEYCODE_RIGHT;
-	}
-
-	// Restore background
-	restoreChar();
-
-	if (_answers[_lineNum][_charNum]) {
-		Common::String str = Common::String::format("%c", _answers[_lineNum][_charNum]);
-		_surface.writeString(str, Common::Point(_cursorPos.x + screen.widestChar() / 2
-			- screen.charWidth(_answers[_lineNum][_charNum]) / 2, _cursorPos.y), 0);
-	}
-
-	switch (keyState.keycode) {
-	case Common::KEYCODE_ESCAPE:
-		close();
-		break;
-
-	case Common::KEYCODE_UP:
-		if (_lineNum) {
-			--_lineNum;
-			if (_charNum >= (int)strlen(_solutions[_lineNum]))
-				_charNum = (int)strlen(_solutions[_lineNum]) - 1;
-		}
-		break;
-
-	case Common::KEYCODE_DOWN:
-		if (_lineNum < 2) {
-			++_lineNum;
-			if (_charNum >= (int)strlen(_solutions[_lineNum]))
-				_charNum = (int)strlen(_solutions[_lineNum]) - 1;
-		}
-		break;
-
-	case Common::KEYCODE_BACKSPACE:
-	case Common::KEYCODE_LEFT:
-		if (_charNum)
-			--_charNum;
-		else if (_lineNum) {
-			--_lineNum;
-
-			_charNum = strlen(_solutions[_lineNum]) - 1;
-		}
-
-		if (keyState.keycode == Common::KEYCODE_BACKSPACE)
-			_answers[_lineNum][_charNum] = ' ';
-		break;
-
-	case Common::KEYCODE_RIGHT:
-		if (_charNum < (int)strlen(_solutions[_lineNum]) - 1)
-			++_charNum;
-		else if (_lineNum < 2) {
-			++_lineNum;
-			_charNum = 0;
-		}
-		break;
-
-	case Common::KEYCODE_DELETE:
-		_answers[_lineNum][_charNum] = ' ';
-		break;
-
-	default:
-		break;
-	}
-
-	_cursorPos.x = _lines[_lineNum].x + 8 - screen.widestChar() / 2 + _charNum * _spacing;
-	_cursorPos.y = _lines[_lineNum].y - screen.fontHeight() - 2;
-
-	// 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;
-		close();
-	}
-}
-
-void WidgetHangman::restoreChar() {
-	Screen &screen = *_vm->_screen;
-	ImageFrame &bgFrame = (*_images)[0];
-	_surface.blitFrom(bgFrame, _cursorPos, Common::Rect(_cursorPos.x, _cursorPos.y,
-		_cursorPos.x + screen.widestChar(), _cursorPos.y + screen.fontHeight()));
-}
-
-void WidgetHangman::close() {
-	TattooScene &scene = *(TattooScene *)_vm->_scene;
-	Talk &talk = *_vm->_talk;
-	TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui;
-	delete _images;
-	_images = nullptr;
-
-	// Close the window
-	banishWindow();
-	ui._menuMode = scene._labTableScene ? LAB_MODE : STD_MODE;
-
-	// Don't call the talk files if the puzzle has already been solved
-	if (!_vm->readFlags(299)) {
-		// Run the appropriate script depending on whether or not they solved the puzzle correctly
-		if (_solved) {
-			talk.talkTo("SLVE12S.TLK");
-			talk.talkTo("WATS12X.TLK");
-			_vm->setFlags(299);
-		} else {
-			talk.talkTo("HOLM12X.TLK");
-		}
-	}
-}
-
-} // End of namespace Tattoo
-
-} // End of namespace Sherlock
diff --git a/engines/sherlock/tattoo/widget_hangman.h b/engines/sherlock/tattoo/widget_hangman.h
deleted file mode 100644
index c653f93..0000000
--- a/engines/sherlock/tattoo/widget_hangman.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/* 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_TATTOO_HANGMAN_H
-#define SHERLOCK_TATTOO_HANGMAN_H
-
-#include "sherlock/tattoo/widget_base.h"
-#include "sherlock/image_file.h"
-
-namespace Sherlock {
-
-namespace Tattoo {
-
-class TattooEngine;
-
-class WidgetHangman: public WidgetBase {
-private:
-	ImageFile *_images;
-	Common::Point _lines[3];
-	char _answers[3][10];
-	const char *_solutions[3];
-	int _numWide;
-	int _spacing;
-	Common::Point _cursorPos;
-	int _blinkCounter;
-	bool _blinkFlag;
-	int _lineNum, _charNum;
-	bool _solved;
-
-	/**
-	 * Handle keyboard events
-	 */
-	void handleKeyboardEvents();
-
-	/**
-	 * Restore the background for the current line/horiz position
-	 */
-	void restoreChar();
-public:
-	WidgetHangman(TattooEngine *vm);
-	virtual ~WidgetHangman();
-
-	/**
-	 * Show the hangman puzzle
-	 */
-	void show();
-
-	/**
-	 * Close the window
-	 */
-	void close();
-
-	/**
-	* Handle events whilst the widget is on-screen
-	*/
-	virtual void handleEvents();
-};
-
-} // End of namespace Tattoo
-
-} // End of namespace Sherlock
-
-#endif
diff --git a/engines/sherlock/tattoo/widget_inventory.cpp b/engines/sherlock/tattoo/widget_inventory.cpp
index 8ec3bd7..4653172 100644
--- a/engines/sherlock/tattoo/widget_inventory.cpp
+++ b/engines/sherlock/tattoo/widget_inventory.cpp
@@ -407,7 +407,7 @@ void WidgetInventoryVerbs::handleEvents() {
 				ui._menuMode = scene._labTableScene ? LAB_MODE : STD_MODE;
 
 				scene.doBgAnim();
-				vm.doHangManPuzzle();
+				vm.doFoolscapPuzzle();
 			} else if (_invVerbSelect == 0) {
 				// They have released the mouse on the Look Verb command, so Look at the inventory item
 				ui._invLookFlag = true;
@@ -733,7 +733,7 @@ void WidgetInventory::handleEvents() {
 							ui._menuMode = scene._labTableScene ? LAB_MODE : STD_MODE;
 
 							scene.doBgAnim();
-							vm.doHangManPuzzle();
+							vm.doFoolscapPuzzle();
 						} else {
 							ui._invLookFlag = true;
 							inv.freeInv();






More information about the Scummvm-git-logs mailing list