aboutsummaryrefslogtreecommitdiff
path: root/engines/sherlock
diff options
context:
space:
mode:
authorPaul Gilbert2015-03-31 21:30:22 -0400
committerPaul Gilbert2015-03-31 21:30:22 -0400
commit8fa8b14762ce655d0d99782864be927d3c946cba (patch)
tree52e905869490908c81d221034048e67fc5720dd5 /engines/sherlock
parent54ecf6cda88f6a32b0e12f9fdb2698c540d76bd4 (diff)
downloadscummvm-rg350-8fa8b14762ce655d0d99782864be927d3c946cba.tar.gz
scummvm-rg350-8fa8b14762ce655d0d99782864be927d3c946cba.tar.bz2
scummvm-rg350-8fa8b14762ce655d0d99782864be927d3c946cba.zip
SHERLOCK: Implement clearTalking and Talk::drawInterface
Diffstat (limited to 'engines/sherlock')
-rw-r--r--engines/sherlock/people.cpp36
-rw-r--r--engines/sherlock/people.h4
-rw-r--r--engines/sherlock/talk.cpp35
-rw-r--r--engines/sherlock/talk.h2
-rw-r--r--engines/sherlock/user_interface.h2
5 files changed, 71 insertions, 8 deletions
diff --git a/engines/sherlock/people.cpp b/engines/sherlock/people.cpp
index ca840bb5b1..8d4fa68117 100644
--- a/engines/sherlock/people.cpp
+++ b/engines/sherlock/people.cpp
@@ -57,13 +57,16 @@ People::People(SherlockEngine *vm) : _vm(vm), _player(_data[0]) {
_oldWalkSequence = -1;
_allowWalkAbort = false;
_portraitLoaded = false;
+ _portraitsOn = false;
_clearingThePortrait = false;
_srcZone = _destZone = 0;
+ _talkPics = nullptr;
}
People::~People() {
if (_walkLoaded)
delete _data[PLAYER]._images;
+ delete _talkPics;
}
void People::reset() {
@@ -434,4 +437,37 @@ void People::goAllTheWay() {
}
}
+/**
+ * Turn off any currently active portraits, and removes them from being drawn
+ */
+void People::clearTalking() {
+ Scene &scene = *_vm->_scene;
+ Screen &screen = *_vm->_screen;
+ Talk &talk = *_vm->_talk;
+
+ if (_portraitsOn) {
+ Common::Point pt = _portrait._position;
+ int width, height;
+ _portrait._imageFrame = _talkPics ? &(*_talkPics)[0] : (ImageFrame *)nullptr;
+
+ // Flag portrait for removal, and save the size of the frame to use erasing it
+ _portrait._type = REMOVE;
+ _portrait._delta.x = width = _portrait.frameWidth();
+ _portrait._delta.y = height = _portrait.frameHeight();
+
+ delete _talkPics;
+ _talkPics = nullptr;
+
+ // Flag to let the talk code know not to interrupt on the next doBgAnim
+ _clearingThePortrait = true;
+ scene.doBgAnim();
+ _clearingThePortrait = false;
+
+ screen.slamArea(pt.x, pt.y, width, height);
+
+ if (!talk._talkToAbort)
+ _portraitLoaded = false;
+ }
+}
+
} // End of namespace Sherlock
diff --git a/engines/sherlock/people.h b/engines/sherlock/people.h
index 6b5c59b1bd..1c67ff8996 100644
--- a/engines/sherlock/people.h
+++ b/engines/sherlock/people.h
@@ -66,12 +66,14 @@ private:
bool _walkLoaded;
int _oldWalkSequence;
int _srcZone, _destZone;
+ ImageFile *_talkPics;
public:
Common::Point _walkDest;
Common::Stack<Common::Point> _walkTo;
Person &_player;
bool _holmesOn;
bool _portraitLoaded;
+ bool _portraitsOn;
Object _portrait;
bool _clearingThePortrait;
bool _allowWalkAbort;
@@ -96,6 +98,8 @@ public:
void walkToCoords(const Common::Point &destPos, int destDir);
void goAllTheWay();
+
+ void clearTalking();
};
} // End of namespace Sherlock
diff --git a/engines/sherlock/talk.cpp b/engines/sherlock/talk.cpp
index e5d6cea64a..79f9167506 100644
--- a/engines/sherlock/talk.cpp
+++ b/engines/sherlock/talk.cpp
@@ -190,7 +190,7 @@ void Talk::talkTo(const Common::String &filename) {
case TALK_MODE:
if (_speaker < 128)
- clearTalking();
+ people.clearTalking();
if (_talkCounter)
return;
@@ -554,10 +554,6 @@ void Talk::loadTalkFile(const Common::String &filename) {
setTalkMap();
}
-void Talk::clearTalking() {
- // TODO
-}
-
/**
* Remove any voice commands from a loaded statement list
*/
@@ -604,8 +600,35 @@ void Talk::setTalkMap() {
}
}
+/**
+ * Draws the interface for conversation display
+ */
void Talk::drawInterface() {
- // TODO
+ Screen &screen = *_vm->_screen;
+ Surface &bb = *screen._backBuffer;
+
+ bb.fillRect(Common::Rect(0, CONTROLS_Y, SHERLOCK_SCREEN_WIDTH, CONTROLS_Y1 + 10), BORDER_COLOR);
+ bb.fillRect(Common::Rect(0, CONTROLS_Y + 10, 2, SHERLOCK_SCREEN_HEIGHT), BORDER_COLOR);
+ bb.fillRect(Common::Rect(SHERLOCK_SCREEN_WIDTH - 2, CONTROLS_Y + 10,
+ SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT), BORDER_COLOR);
+ bb.fillRect(Common::Rect(0, SHERLOCK_SCREEN_HEIGHT - 1, SHERLOCK_SCREEN_WIDTH - 2,
+ SHERLOCK_SCREEN_HEIGHT), BORDER_COLOR);
+ bb.fillRect(Common::Rect(2, CONTROLS_Y + 10, SHERLOCK_SCREEN_WIDTH - 2,
+ SHERLOCK_SCREEN_HEIGHT - 2), INV_BACKGROUND);
+
+ if (_talkTo != -1) {
+ screen.makeButton(Common::Rect(99, CONTROLS_Y, 139, CONTROLS_Y + 10),
+ 119 - screen.stringWidth("Exit") / 2, "Exit");
+ screen.makeButton(Common::Rect(140, CONTROLS_Y, 180, CONTROLS_Y + 10),
+ 159 - screen.stringWidth("Up"), "Up");
+ screen.makeButton(Common::Rect(181, CONTROLS_Y, 221, CONTROLS_Y + 10),
+ 200 - screen.stringWidth("Down") / 2, "Down");
+ } else {
+ int strWidth = screen.stringWidth(PRESS_KEY_TO_CONTINUE);
+ screen.makeButton(Common::Rect(46, CONTROLS_Y, 273, CONTROLS_Y + 10),
+ 160 - strWidth, PRESS_KEY_TO_CONTINUE);
+ screen.gPrint(Common::Point(160 - strWidth / 2, CONTROLS_Y), COMMAND_FOREGROUND, false, "P");
+ }
}
/**
diff --git a/engines/sherlock/talk.h b/engines/sherlock/talk.h
index d44419f9a9..dbcdf742b8 100644
--- a/engines/sherlock/talk.h
+++ b/engines/sherlock/talk.h
@@ -81,8 +81,6 @@ private:
void loadTalkFile(const Common::String &filename);
- void clearTalking();
-
void stripVoiceCommands();
void setTalkMap();
diff --git a/engines/sherlock/user_interface.h b/engines/sherlock/user_interface.h
index 1259bed31b..f80fe48b2d 100644
--- a/engines/sherlock/user_interface.h
+++ b/engines/sherlock/user_interface.h
@@ -55,6 +55,8 @@ extern const int MENU_POINTS[12][4];
extern const int INVENTORY_POINTS[8][3];
extern const char INVENTORY_COMMANDS[9];
+extern const char *const PRESS_KEY_FOR_MORE;
+extern const char *const PRESS_KEY_TO_CONTINUE;
class SherlockEngine;
class Inventory;