aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/sherlock/objects.cpp17
-rw-r--r--engines/sherlock/objects.h7
-rw-r--r--engines/sherlock/scalpel/scalpel_user_interface.cpp6
-rw-r--r--engines/sherlock/tattoo/tattoo_user_interface.h5
-rw-r--r--engines/sherlock/user_interface.cpp2
-rw-r--r--engines/sherlock/user_interface.h2
6 files changed, 14 insertions, 25 deletions
diff --git a/engines/sherlock/objects.cpp b/engines/sherlock/objects.cpp
index 9005235d5a..04092955e5 100644
--- a/engines/sherlock/objects.cpp
+++ b/engines/sherlock/objects.cpp
@@ -533,6 +533,10 @@ WalkSequences &WalkSequences::operator=(const WalkSequences &src) {
/*----------------------------------------------------------------*/
+ActionType::ActionType() {
+ _cAnimNum = _cAnimSpeed = 0;
+}
+
void ActionType::load(Common::SeekableReadStream &s) {
char buffer[12];
@@ -549,8 +553,7 @@ void ActionType::load(Common::SeekableReadStream &s) {
/*----------------------------------------------------------------*/
-UseType::UseType() {
- _cAnimNum = _cAnimSpeed = 0;
+UseType::UseType(): ActionType() {
_useFlag = 0;
}
@@ -562,15 +565,7 @@ void UseType::load(Common::SeekableReadStream &s, bool isRoseTattoo) {
_verb = Common::String(buffer);
}
- _cAnimNum = s.readByte();
- _cAnimSpeed = s.readByte();
- if (_cAnimSpeed & 0x80)
- _cAnimSpeed = -(_cAnimSpeed & 0x7f);
-
- for (int idx = 0; idx < NAMES_COUNT; ++idx) {
- s.read(buffer, 12);
- _names[idx] = Common::String(buffer);
- }
+ ActionType::load(s);
_useFlag = s.readSint16LE();
diff --git a/engines/sherlock/objects.h b/engines/sherlock/objects.h
index 6a71166ee9..a219484a62 100644
--- a/engines/sherlock/objects.h
+++ b/engines/sherlock/objects.h
@@ -144,16 +144,15 @@ struct ActionType {
int _cAnimSpeed;
Common::String _names[NAMES_COUNT];
+ ActionType();
+
/**
* Load the data for the action
*/
void load(Common::SeekableReadStream &s);
};
-struct UseType {
- int _cAnimNum;
- int _cAnimSpeed;
- Common::String _names[NAMES_COUNT];
+struct UseType: public ActionType {
int _useFlag; // Which flag USE will set (if any)
Common::String _target;
Common::String _verb;
diff --git a/engines/sherlock/scalpel/scalpel_user_interface.cpp b/engines/sherlock/scalpel/scalpel_user_interface.cpp
index 302e95867c..3345ef4e8e 100644
--- a/engines/sherlock/scalpel/scalpel_user_interface.cpp
+++ b/engines/sherlock/scalpel/scalpel_user_interface.cpp
@@ -1419,7 +1419,7 @@ void ScalpelUserInterface::doMiscControl(int allowed) {
switch (allowed) {
case ALLOW_OPEN:
- checkAction(obj._aOpen, MOPEN, _temp);
+ checkAction(obj._aOpen, _temp, MOPEN);
if (_menuMode != TALK_MODE && !talk._talkToAbort) {
_menuMode = STD_MODE;
restoreButton(OPEN_MODE - 1);
@@ -1428,7 +1428,7 @@ void ScalpelUserInterface::doMiscControl(int allowed) {
break;
case ALLOW_CLOSE:
- checkAction(obj._aClose, MCLOSE, _temp);
+ checkAction(obj._aClose, _temp, MCLOSE);
if (_menuMode != TALK_MODE && !talk._talkToAbort) {
_menuMode = STD_MODE;
restoreButton(CLOSE_MODE - 1);
@@ -1437,7 +1437,7 @@ void ScalpelUserInterface::doMiscControl(int allowed) {
break;
case ALLOW_MOVE:
- checkAction(obj._aMove, MMOVE, _temp);
+ checkAction(obj._aMove, _temp, MMOVE);
if (_menuMode != TALK_MODE && !talk._talkToAbort) {
_menuMode = STD_MODE;
restoreButton(MOVE_MODE - 1);
diff --git a/engines/sherlock/tattoo/tattoo_user_interface.h b/engines/sherlock/tattoo/tattoo_user_interface.h
index ef56e5903a..644b20a6b3 100644
--- a/engines/sherlock/tattoo/tattoo_user_interface.h
+++ b/engines/sherlock/tattoo/tattoo_user_interface.h
@@ -182,11 +182,6 @@ public:
* Draw the user interface onto the screen's back buffers
*/
virtual void drawInterface(int bufferNum = 3);
-
-
- void checkAction(UseType &use, int objNum) {
- // TODO: Get rid of this stub, and properly use the UserInterface method
- }
};
} // End of namespace Tattoo
diff --git a/engines/sherlock/user_interface.cpp b/engines/sherlock/user_interface.cpp
index 8ab26aca62..ba94d53aae 100644
--- a/engines/sherlock/user_interface.cpp
+++ b/engines/sherlock/user_interface.cpp
@@ -54,7 +54,7 @@ UserInterface::UserInterface(SherlockEngine *vm) : _vm(vm) {
}
-void UserInterface::checkAction(ActionType &action, const char *const messages[], int objNum) {
+void UserInterface::checkAction(ActionType &action, int objNum, const char *const messages[]) {
Events &events = *_vm->_events;
People &people = *_vm->_people;
Scene &scene = *_vm->_scene;
diff --git a/engines/sherlock/user_interface.h b/engines/sherlock/user_interface.h
index b416fd4665..1692ff7bc2 100644
--- a/engines/sherlock/user_interface.h
+++ b/engines/sherlock/user_interface.h
@@ -64,7 +64,7 @@ protected:
/**
* Called for OPEN, CLOSE, and MOVE actions are being done
*/
- void checkAction(ActionType &action, const char *const messages[], int objNum);
+ void checkAction(ActionType &action, int objNum, const char *const messages[] = nullptr);
public:
MenuMode _menuMode;
int _menuCounter;