[Scummvm-cvs-logs] scummvm master -> 239784b13dd12c3f731312c5277dbc9fb0ab47ed

dreammaster dreammaster at scummvm.org
Tue Jun 23 03:39:52 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:
239784b13d SHERLOCK: RT: Beginnings of look window display


Commit: 239784b13dd12c3f731312c5277dbc9fb0ab47ed
    https://github.com/scummvm/scummvm/commit/239784b13dd12c3f731312c5277dbc9fb0ab47ed
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2015-06-22T21:38:52-04:00

Commit Message:
SHERLOCK: RT: Beginnings of look window display

Changed paths:
    engines/sherlock/tattoo/tattoo_journal.cpp
    engines/sherlock/tattoo/tattoo_talk.cpp
    engines/sherlock/tattoo/tattoo_talk.h
    engines/sherlock/tattoo/tattoo_user_interface.cpp
    engines/sherlock/tattoo/tattoo_user_interface.h
    engines/sherlock/tattoo/widget_base.cpp



diff --git a/engines/sherlock/tattoo/tattoo_journal.cpp b/engines/sherlock/tattoo/tattoo_journal.cpp
index c419b9e..e3f681b 100644
--- a/engines/sherlock/tattoo/tattoo_journal.cpp
+++ b/engines/sherlock/tattoo/tattoo_journal.cpp
@@ -854,7 +854,7 @@ int TattooJournal::getFindName(bool printError) {
 			if (keyState.ascii && keyState.ascii != '@' && name.size() < 50) {
 				if ((cursorX + screen.charWidth(keyState.ascii)) < (r.right - screen.widestChar() * 3)) {
 					cursorX += screen.charWidth(keyState.ascii);
-					name += keyState.ascii;
+					name += toupper(keyState.ascii);
 				}
 			}
 
diff --git a/engines/sherlock/tattoo/tattoo_talk.cpp b/engines/sherlock/tattoo/tattoo_talk.cpp
index 2da3005..52b6b51 100644
--- a/engines/sherlock/tattoo/tattoo_talk.cpp
+++ b/engines/sherlock/tattoo/tattoo_talk.cpp
@@ -22,6 +22,7 @@
 
 #include "sherlock/tattoo/tattoo_talk.h"
 #include "sherlock/tattoo/tattoo_people.h"
+#include "sherlock/tattoo/tattoo_user_interface.h"
 #include "sherlock/sherlock.h"
 #include "sherlock/screen.h"
 
@@ -182,7 +183,7 @@ TattooTalk::TattooTalk(SherlockEngine *vm) : Talk(vm) {
 }
 
 void TattooTalk::talkInterface(const byte *&str) {
-	drawTalk(str);
+	drawTalk((const char *)str);
 
 	_charCount = 0;
 	while ((*str < TATTOO_OPCODES[0] || *str == TATTOO_OPCODES[OP_NULL]) && *str) {
@@ -193,8 +194,12 @@ void TattooTalk::talkInterface(const byte *&str) {
 	_wait = true;
 }
 
-void TattooTalk::drawTalk(const byte *str) {
-	// TODO
+void TattooTalk::drawTalk(const char *str) {
+	TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui;
+
+	ui.banishWindow();
+	ui._textWidget.load(str);
+	ui._textWidget.summonWindow();
 }
 
 OpcodeReturn TattooTalk::cmdSwitchSpeaker(const byte *&str) {
diff --git a/engines/sherlock/tattoo/tattoo_talk.h b/engines/sherlock/tattoo/tattoo_talk.h
index d7464c3..9fd6f05 100644
--- a/engines/sherlock/tattoo/tattoo_talk.h
+++ b/engines/sherlock/tattoo/tattoo_talk.h
@@ -74,7 +74,7 @@ private:
 	OpcodeReturn cmdWalkNPCToCoords(const byte *&str);
 	OpcodeReturn cmdWalkHomesAndNPCToCoords(const byte *&str);
 private:
-	void drawTalk(const byte *str);
+	void drawTalk(const char *str);
 protected:
 	/**
 	 * Display the talk interface window
diff --git a/engines/sherlock/tattoo/tattoo_user_interface.cpp b/engines/sherlock/tattoo/tattoo_user_interface.cpp
index f1b75f4..01b0b63 100644
--- a/engines/sherlock/tattoo/tattoo_user_interface.cpp
+++ b/engines/sherlock/tattoo/tattoo_user_interface.cpp
@@ -247,7 +247,11 @@ void TattooUserInterface::handleInput() {
 		if (_keyState.keycode == Common::KEYCODE_s && vm._allowFastMode)
 			vm._fastMode = !vm._fastMode;
 
-		else if (_keyState.keycode == Common::KEYCODE_ESCAPE && vm._runningProlog && !_lockoutTimer) {
+		else if (_keyState.keycode == Common::KEYCODE_l && _bgFound != -1) {
+			// Beging used for testing that Look dialogs work
+			lookAtObject();
+
+		} else if (_keyState.keycode == Common::KEYCODE_ESCAPE && vm._runningProlog && !_lockoutTimer) {
 			vm.setFlags(-76);
 			vm.setFlags(396);
 			scene._goToScene = STARTING_GAME_SCENE;
@@ -928,6 +932,12 @@ void TattooUserInterface::drawDialogRect(Surface &s, const Common::Rect &r, bool
 	}
 }
 
+void TattooUserInterface::banishWindow() {
+	if (_widget != nullptr)
+		_widget->banishWindow();
+	_widget = nullptr;
+}
+
 } // End of namespace Tattoo
 
 } // End of namespace Sherlock
diff --git a/engines/sherlock/tattoo/tattoo_user_interface.h b/engines/sherlock/tattoo/tattoo_user_interface.h
index 2ff046b..bb9e1d9 100644
--- a/engines/sherlock/tattoo/tattoo_user_interface.h
+++ b/engines/sherlock/tattoo/tattoo_user_interface.h
@@ -59,7 +59,6 @@ private:
 	int _scriptZone;
 	int _cAnimFramePause;
 	WidgetInventory _inventoryWidget;
-	WidgetText _textWidget;
 	WidgetSceneTooltip _tooltipWidget;
 	WidgetVerbs _verbsWidget;
 	WidgetBase *_widget;
@@ -147,6 +146,7 @@ public:
 	Common::Point _maskOffset;
 	int _maskCounter;
 	ImageFile *_interfaceImages;
+	WidgetText _textWidget;
 public:
 	TattooUserInterface(SherlockEngine *vm);
 	virtual ~TattooUserInterface();
@@ -221,6 +221,11 @@ public:
 	 * Draws all the dialog rectangles for any items that need them
 	 */
 	void drawDialogRect(Surface &s, const Common::Rect &r, bool raised);
+
+	/**
+	 * Banish any active window
+	 */
+	void banishWindow();
 public:
 	/**
 	 * Resets the user interface
diff --git a/engines/sherlock/tattoo/widget_base.cpp b/engines/sherlock/tattoo/widget_base.cpp
index 1df14ff..cd4f8e0 100644
--- a/engines/sherlock/tattoo/widget_base.cpp
+++ b/engines/sherlock/tattoo/widget_base.cpp
@@ -36,11 +36,16 @@ void WidgetBase::summonWindow() {
 	TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui;
 	ui._widget = this;
 	_outsideMenu = false;
+
+	draw();
 }
 
 void WidgetBase::banishWindow() {
-	// TODO
+	TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui;
+
+	erase();
 	_surface.free();
+	ui._widget = nullptr;
 }
 
 void WidgetBase::erase() {
@@ -90,7 +95,7 @@ Common::String WidgetBase::splitLines(const Common::String &str, Common::StringA
 
 	// Loop counting up lines
 	lines.clear();
-	while (lines.size() < maxLines) {
+	do {
 		int width = 0;
 		const char *spaceP = nullptr;
 		const char *lineStartP = strP;
@@ -117,7 +122,8 @@ Common::String WidgetBase::splitLines(const Common::String &str, Common::StringA
 		// Move the string ahead to the next line
 		if (*strP == ' ' || *strP == 13)
 			++strP;
-	} while (*strP && ((byte)*strP < talk._opcodes[OP_SWITCH_SPEAKER] || (byte)*strP == talk._opcodes[OP_NULL]));
+	} while (*strP && ((int)lines.size() < maxLines) && ((byte)*strP < talk._opcodes[OP_SWITCH_SPEAKER] 
+			|| (byte)*strP == talk._opcodes[OP_NULL]));
 
 	// Return any remaining text left over
 	return *strP ? Common::String(strP) : Common::String();






More information about the Scummvm-git-logs mailing list