[Scummvm-cvs-logs] scummvm master -> 6238acff3c317bf4a9367a4dc1c2e2d9c149287e
bluegr
bluegr at gmail.com
Thu Jun 18 11:27:36 CEST 2015
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
5ece075b58 SHERLOCK: RT: Reduce code duplication when writing fancy strings
5c8001224b SHERLOCK: Add a sanity check in checkObject()
6238acff3c SHERLOCK: RT: Initial work on activateVerbMenu()
Commit: 5ece075b582418b38f194c1f39a06c8c7343aeeb
https://github.com/scummvm/scummvm/commit/5ece075b582418b38f194c1f39a06c8c7343aeeb
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2015-06-18T12:24:53+03:00
Commit Message:
SHERLOCK: RT: Reduce code duplication when writing fancy strings
Changed paths:
engines/sherlock/surface.cpp
engines/sherlock/surface.h
engines/sherlock/tattoo/tattoo_map.cpp
engines/sherlock/tattoo/widget_tooltip.cpp
diff --git a/engines/sherlock/surface.cpp b/engines/sherlock/surface.cpp
index 48045be..79711b4 100644
--- a/engines/sherlock/surface.cpp
+++ b/engines/sherlock/surface.cpp
@@ -280,6 +280,18 @@ void Surface::writeString(const Common::String &str, const Common::Point &pt, by
Fonts::writeString(this, str, pt, overrideColor);
}
+void Surface::writeFancyString(const Common::String &str, const Common::Point &pt, byte overrideColor1, byte overrideColor2) {
+ writeString(str, Common::Point(pt.x, pt.y), overrideColor1);
+ writeString(str, Common::Point(pt.x + 1, pt.y), overrideColor1);
+ writeString(str, Common::Point(pt.x + 2, pt.y), overrideColor1);
+ writeString(str, Common::Point(pt.x, pt.y + 1), overrideColor1);
+ writeString(str, Common::Point(pt.x + 2, pt.y + 1), overrideColor1);
+ writeString(str, Common::Point(pt.x, pt.y + 2), overrideColor1);
+ writeString(str, Common::Point(pt.x + 1, pt.y + 2), overrideColor1);
+ writeString(str, Common::Point(pt.x + 2, pt.y + 2), overrideColor1);
+ writeString(str, Common::Point(pt.x + 1, pt.y + 1), overrideColor2);
+}
+
void Surface::maskArea(const ImageFrame &src, const Common::Point &pt, int scrollX) {
// TODO
error("TODO: maskArea");
diff --git a/engines/sherlock/surface.h b/engines/sherlock/surface.h
index 150796e..adda03d 100644
--- a/engines/sherlock/surface.h
+++ b/engines/sherlock/surface.h
@@ -168,6 +168,7 @@ public:
* Draws the given string into the back buffer using the images stored in _font
*/
virtual void writeString(const Common::String &str, const Common::Point &pt, byte overrideColor);
+ void writeFancyString(const Common::String &str, const Common::Point &pt, byte overrideColor1, byte overrideColor2);
inline uint16 w() const { return _surface.w; }
inline uint16 h() const { return _surface.h; }
diff --git a/engines/sherlock/tattoo/tattoo_map.cpp b/engines/sherlock/tattoo/tattoo_map.cpp
index 7283428..3be97c8 100644
--- a/engines/sherlock/tattoo/tattoo_map.cpp
+++ b/engines/sherlock/tattoo/tattoo_map.cpp
@@ -396,15 +396,7 @@ void TattooMap::checkMapNames(bool slamIt) {
_textBuffer->fillRect(Common::Rect(0, 0, width, height), TRANSPARENCY);
if (space == nullptr) {
// The whole text can be drawn on a single line
- _textBuffer->writeString(desc, Common::Point(0, 0), BLACK);
- _textBuffer->writeString(desc, Common::Point(1, 0), BLACK);
- _textBuffer->writeString(desc, Common::Point(2, 0), BLACK);
- _textBuffer->writeString(desc, Common::Point(0, 1), BLACK);
- _textBuffer->writeString(desc, Common::Point(2, 1), BLACK);
- _textBuffer->writeString(desc, Common::Point(0, 2), BLACK);
- _textBuffer->writeString(desc, Common::Point(1, 2), BLACK);
- _textBuffer->writeString(desc, Common::Point(2, 2), BLACK);
- _textBuffer->writeString(desc, Common::Point(1, 1), MAP_NAME_COLOR);
+ _textBuffer->writeFancyString(desc, Common::Point(0, 0), BLACK, MAP_NAME_COLOR);
} else {
// The text needs to be split up over two lines
Common::String line1(desc.c_str(), space);
@@ -412,28 +404,12 @@ void TattooMap::checkMapNames(bool slamIt) {
// Draw the first line
int xp = (width - screen.stringWidth(desc)) / 2;
- _textBuffer->writeString(line1, Common::Point(xp + 0, 0), BLACK);
- _textBuffer->writeString(line1, Common::Point(xp + 1, 0), BLACK);
- _textBuffer->writeString(line1, Common::Point(xp + 2, 0), BLACK);
- _textBuffer->writeString(line1, Common::Point(xp + 0, 1), BLACK);
- _textBuffer->writeString(line1, Common::Point(xp + 2, 1), BLACK);
- _textBuffer->writeString(line1, Common::Point(xp + 0, 2), BLACK);
- _textBuffer->writeString(line1, Common::Point(xp + 1, 2), BLACK);
- _textBuffer->writeString(line1, Common::Point(xp + 2, 2), BLACK);
- _textBuffer->writeString(line1, Common::Point(xp + 1, 1), MAP_NAME_COLOR);
+ _textBuffer->writeFancyString(line1, Common::Point(xp, 0), BLACK, MAP_NAME_COLOR);
int yp = screen.stringHeight(line2);
xp = (width - screen.stringWidth(line2)) / 2;
// CHECKME: Shouldn't we use yp for drawing line2?
- _textBuffer->writeString(line2, Common::Point(xp + 0, yp), BLACK);
- _textBuffer->writeString(line2, Common::Point(xp + 1, yp), BLACK);
- _textBuffer->writeString(line2, Common::Point(xp + 2, yp), BLACK);
- _textBuffer->writeString(line2, Common::Point(xp + 0, yp + 1), BLACK);
- _textBuffer->writeString(line2, Common::Point(xp + 2, yp + 1), BLACK);
- _textBuffer->writeString(line2, Common::Point(xp + 0, yp + 2), BLACK);
- _textBuffer->writeString(line2, Common::Point(xp + 1, yp + 2), BLACK);
- _textBuffer->writeString(line2, Common::Point(xp + 2, yp + 2), BLACK);
- _textBuffer->writeString(line2, Common::Point(xp + 1, yp + 1), MAP_NAME_COLOR);
+ _textBuffer->writeFancyString(line2, Common::Point(xp, yp), BLACK, MAP_NAME_COLOR);
}
// Set the text display position
diff --git a/engines/sherlock/tattoo/widget_tooltip.cpp b/engines/sherlock/tattoo/widget_tooltip.cpp
index ee4b3ce..7d513b7 100644
--- a/engines/sherlock/tattoo/widget_tooltip.cpp
+++ b/engines/sherlock/tattoo/widget_tooltip.cpp
@@ -116,40 +116,16 @@ void WidgetTooltip::execute() {
if (line2.empty()) {
// Only a single line
- _surface.writeString(str, Common::Point(0, 0), BLACK);
- _surface.writeString(str, Common::Point(1, 0), BLACK);
- _surface.writeString(str, Common::Point(2, 0), BLACK);
- _surface.writeString(str, Common::Point(0, 1), BLACK);
- _surface.writeString(str, Common::Point(2, 1), BLACK);
- _surface.writeString(str, Common::Point(0, 2), BLACK);
- _surface.writeString(str, Common::Point(1, 2), BLACK);
- _surface.writeString(str, Common::Point(2, 2), BLACK);
- _surface.writeString(str, Common::Point(1, 1), INFO_TOP);
+ _surface.writeFancyString(str, Common::Point(0, 0), BLACK, INFO_TOP);
} else {
// Two lines to display
int xp, yp;
xp = (width - screen.stringWidth(line1) - 2) / 2;
- _surface.writeString(line1, Common::Point(xp, 0), BLACK);
- _surface.writeString(line1, Common::Point(xp + 1, 0), BLACK);
- _surface.writeString(line1, Common::Point(xp + 2, 0), BLACK);
- _surface.writeString(line1, Common::Point(xp, 1), BLACK);
- _surface.writeString(line1, Common::Point(xp + 2, 1), BLACK);
- _surface.writeString(line1, Common::Point(xp, 2), BLACK);
- _surface.writeString(line1, Common::Point(xp + 1, 2), BLACK);
- _surface.writeString(line1, Common::Point(xp + 2, 2), BLACK);
- _surface.writeString(line1, Common::Point(xp + 1, 1), INFO_TOP);
+ _surface.writeFancyString(line1, Common::Point(xp, 0), BLACK, INFO_TOP);
xp = (width - screen.stringWidth(line2) - 2) / 2;
yp = screen.stringHeight(line1) + 2;
- _surface.writeString(line2, Common::Point(xp, yp), BLACK);
- _surface.writeString(line2, Common::Point(xp + 1, yp), BLACK);
- _surface.writeString(line2, Common::Point(xp + 2, yp), BLACK);
- _surface.writeString(line2, Common::Point(xp, yp + 1), BLACK);
- _surface.writeString(line2, Common::Point(xp + 2, yp + 1), BLACK);
- _surface.writeString(line2, Common::Point(xp, yp + 2), BLACK);
- _surface.writeString(line2, Common::Point(xp + 1, yp + 2), BLACK);
- _surface.writeString(line2, Common::Point(xp + 2, yp + 2), BLACK);
- _surface.writeString(line2, Common::Point(xp + 1, yp + 1), INFO_TOP);
+ _surface.writeFancyString(line2, Common::Point(xp, yp), BLACK, INFO_TOP);
}
// Set the initial display position for the tooltip text
Commit: 5c8001224bc859cb7f04fdb8a7acc25b21c251fe
https://github.com/scummvm/scummvm/commit/5c8001224bc859cb7f04fdb8a7acc25b21c251fe
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2015-06-18T12:25:55+03:00
Commit Message:
SHERLOCK: Add a sanity check in checkObject()
This avoids the crash after the second intro scene
Changed paths:
engines/sherlock/objects.cpp
diff --git a/engines/sherlock/objects.cpp b/engines/sherlock/objects.cpp
index be6bd42..ac5296c 100644
--- a/engines/sherlock/objects.cpp
+++ b/engines/sherlock/objects.cpp
@@ -157,6 +157,11 @@ void BaseObject::checkObject() {
++_frameNumber;
do {
+ if (!_sequences) {
+ warning("checkObject: _sequences is not set");
+ break;
+ }
+
// Check for end of sequence
codeFound = checkEndOfSequence();
Commit: 6238acff3c317bf4a9367a4dc1c2e2d9c149287e
https://github.com/scummvm/scummvm/commit/6238acff3c317bf4a9367a4dc1c2e2d9c149287e
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2015-06-18T12:26:17+03:00
Commit Message:
SHERLOCK: RT: Initial work on activateVerbMenu()
Changed paths:
engines/sherlock/tattoo/widget_verbs.cpp
diff --git a/engines/sherlock/tattoo/widget_verbs.cpp b/engines/sherlock/tattoo/widget_verbs.cpp
index 5d7f421..dfe317b 100644
--- a/engines/sherlock/tattoo/widget_verbs.cpp
+++ b/engines/sherlock/tattoo/widget_verbs.cpp
@@ -23,6 +23,7 @@
#include "sherlock/tattoo/widget_verbs.h"
#include "sherlock/tattoo/tattoo_scene.h"
#include "sherlock/tattoo/tattoo_user_interface.h"
+#include "sherlock/tattoo/tattoo_people.h"
#include "sherlock/tattoo/tattoo.h"
namespace Sherlock {
@@ -35,7 +36,65 @@ WidgetVerbs::WidgetVerbs(SherlockEngine *vm) : WidgetBase(vm) {
}
void WidgetVerbs::activateVerbMenu(bool objectsOn) {
+ Talk &talk = *_vm->_talk;
+ FixedText &fixedText = *_vm->_fixedText;
+ TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui;
+ TattooPeople &people = *(TattooPeople *)_vm->_people;
+ bool isWatson = false;
+ Common::String strLook = fixedText.getText(kFixedText_Verb_Look);
+ Common::String strTalk = fixedText.getText(kFixedText_Verb_Talk);
+ Common::String strJournal = fixedText.getText(kFixedText_Verb_Journal);
+
+ if (talk._talkToAbort)
+ return;
+
+ _outsideMenu = false;
+
+ _verbCommands.clear();
+
+ // Check if we need to show options for the highlighted object
+ if (objectsOn) {
+ // Set the verb list accordingly, depending on the target being a
+ // person or an object
+ if (ui._personFound) {
+ TattooPerson &person = people[ui._activeObj - 1000];
+ TattooPerson &npc = people[ui._activeObj - 1001];
+
+ if (!scumm_strnicmp(npc._npcName.c_str(), "WATS", 4))
+ isWatson = true;
+
+ if (!scumm_strnicmp(person._examine.c_str(), "_EXIT", 5))
+ _verbCommands.push_back(strLook);
+
+ _verbCommands.push_back(strTalk);
+
+ // Add any extra active verbs from the NPC's verb list
+ // TODO
+ } else {
+ if (!scumm_strnicmp(ui._bgShape->_name.c_str(), "WATS", 4))
+ isWatson = true;
+
+ if (!scumm_strnicmp(ui._bgShape->_examine.c_str(), "_EXIT", 5))
+ _verbCommands.push_back(strLook);
+
+ if (ui._bgShape->_aType == PERSON)
+ _verbCommands.push_back(strTalk);
+
+ // Add any extra active verbs from the NPC's verb list
+ // TODO
+ }
+ }
+
+ if (isWatson)
+ _verbCommands.push_back(strJournal);
+
+ // Add the system commands
// TODO
+
+ // Find the widest command
+ // TODO
+
+ // TODO: Finish this
}
void WidgetVerbs::execute() {
More information about the Scummvm-git-logs
mailing list