aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2014-04-08 23:01:46 -0400
committerPaul Gilbert2014-04-08 23:01:46 -0400
commit09adb571d35c45941246bdce5db895d9d81fd59c (patch)
tree6051a6e34a3b13e3f30fc2deb8d88dd3dbfb7253 /engines
parent21a0e38f34324423e0f571ccb37a800737cd78d2 (diff)
downloadscummvm-rg350-09adb571d35c45941246bdce5db895d9d81fd59c.tar.gz
scummvm-rg350-09adb571d35c45941246bdce5db895d9d81fd59c.tar.bz2
scummvm-rg350-09adb571d35c45941246bdce5db895d9d81fd59c.zip
MADS: Cleanup of verb/preposition flags handling
Diffstat (limited to 'engines')
-rw-r--r--engines/mads/action.cpp50
-rw-r--r--engines/mads/action.h9
-rw-r--r--engines/mads/inventory.cpp6
-rw-r--r--engines/mads/inventory.h4
-rw-r--r--engines/mads/scene.cpp20
-rw-r--r--engines/mads/scene_data.h7
6 files changed, 52 insertions, 44 deletions
diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp
index a84c329dd0..8cbc404652 100644
--- a/engines/mads/action.cpp
+++ b/engines/mads/action.cpp
@@ -105,7 +105,8 @@ void MADSAction::set() {
// Two 'look' actions in succession, so the action becomes 'Look around'
_statusText = kLookAroundStr;
} else {
- if ((_commandSource == ACTIONMODE_OBJECT) && (_selectedRow >= 0) && (_flags1 == 2) && (_flags2 == 0)) {
+ if ((_commandSource == ACTIONMODE_OBJECT) && (_selectedRow >= 0)
+ && (_verbType == VERB_THAT) && (_prepType == PREP_NONE)) {
// Use/to action
int invIndex = userInterface._selectedInvIndex;
InventoryObject &objEntry = _vm->_game->_objects.getItem(invIndex);
@@ -142,7 +143,7 @@ void MADSAction::set() {
}
// Handling for if a hotspot has been selected/highlighted
- if ((_hotspotId >= 0) && (_selectedRow >= 0) && (_articleNumber > 0) && (_flags1 == 2)) {
+ if ((_hotspotId >= 0) && (_selectedRow >= 0) && (_articleNumber > 0) && (_verbType == VERB_THAT)) {
flag = true;
_statusText += kArticleList[_articleNumber];
@@ -379,8 +380,8 @@ void MADSAction::checkActionAtMousePos() {
if (userInterface._selectedActionIndex >= 0) {
_commandSource = ACTIONMODE_VERB;
_selectedRow = userInterface._selectedActionIndex;
- _flags1 = scene._verbList[_selectedRow]._action1;
- _flags2 = scene._verbList[_selectedRow]._action2;
+ _verbType = scene._verbList[_selectedRow]._verbType;
+ _prepType = scene._verbList[_selectedRow]._prepType;
_interAwaiting = AWAITING_THIS;
} else if (userInterface._selectedItemVocabIdx >= 0) {
_commandSource = ACTIONMODE_OBJECT;
@@ -388,13 +389,14 @@ void MADSAction::checkActionAtMousePos() {
int objectId = _vm->_game->_objects._inventoryList[_selectedRow];
InventoryObject &invObject = _vm->_game->_objects[objectId];
- _flags1 = invObject._vocabList[_selectedRow - 1]._actionFlags1;
- _flags2 = invObject._vocabList[_selectedRow - 1]._actionFlags2;
+ _verbType = invObject._vocabList[_selectedRow - 1]._verbType;
+ _prepType = invObject._vocabList[_selectedRow - 1]._prepType;
_mainObjectSource = ACTIONMODE2_2;
_hotspotId = userInterface._selectedInvIndex;
- _articleNumber = _flags2;
+ _articleNumber = _prepType;
- if ((_flags1 == 1 && _flags2 == 0) || (_flags1 == 2 && _flags2 != 0))
+ if ((_verbType == VERB_THIS && _prepType == PREP_NONE) ||
+ (_verbType == VERB_THAT && _prepType != PREP_NONE))
_interAwaiting = AWAITING_RIGHT_MOUSE;
else
_interAwaiting = AWAITING_THAT;
@@ -412,8 +414,8 @@ void MADSAction::checkActionAtMousePos() {
_commandSource = ACTIONMODE_VERB;
_selectedRow = _pickedWord;
if (_selectedRow >= 0) {
- _flags1 = scene._verbList[_selectedRow]._action1;
- _flags2 = scene._verbList[_selectedRow]._action2;
+ _verbType = scene._verbList[_selectedRow]._verbType;
+ _prepType = scene._verbList[_selectedRow]._prepType;
}
break;
@@ -427,13 +429,13 @@ void MADSAction::checkActionAtMousePos() {
int objectId = _vm->_game->_objects._inventoryList[_selectedRow];
InventoryObject &invObject = _vm->_game->_objects[objectId];
- _flags1 = invObject._vocabList[_selectedRow - 2]._actionFlags1;
- _flags2 = invObject._vocabList[_selectedRow - 2]._actionFlags2;
+ _verbType = invObject._vocabList[_selectedRow - 2]._verbType;
+ _prepType = invObject._vocabList[_selectedRow - 2]._prepType;
_hotspotId = userInterface._selectedInvIndex;
_mainObjectSource = ACTIONMODE2_2;
- if (_flags1 == 2)
- _articleNumber = _flags2;
+ if (_verbType == VERB_THAT)
+ _articleNumber = _prepType;
}
break;
@@ -516,7 +518,7 @@ void MADSAction::leftClick() {
switch (userInterface._category) {
case CAT_COMMAND:
if (_selectedRow >= 0) {
- if (!_flags1) {
+ if (_verbType == VERB_ONLY) {
_selectedAction = -1;
}
else {
@@ -535,17 +537,15 @@ void MADSAction::leftClick() {
case CAT_INV_VOCAB:
if (_selectedRow >= 0) {
- if (_flags1 != 1 || _flags2 != 0) {
- if (_flags1 != 2 || _flags2 == 0) {
+ if (_verbType != VERB_THIS || _prepType != PREP_NONE) {
+ if (_verbType != VERB_THAT || _prepType == PREP_NONE) {
_interAwaiting = AWAITING_THAT;
- _articleNumber = _flags2;
- }
- else {
- _articleNumber = _flags2;
+ _articleNumber = _prepType;
+ } else {
+ _articleNumber = _prepType;
_selectedAction = -1;
}
- }
- else {
+ } else {
_selectedAction = -1;
}
@@ -581,8 +581,8 @@ void MADSAction::leftClick() {
case CAT_HOTSPOT:
case CAT_INV_ANIM:
if (_hotspotId >= 0) {
- if (_flags2) {
- _articleNumber = _flags2;
+ if (_prepType) {
+ _articleNumber = _prepType;
_interAwaiting = AWAITING_THAT;
}
else {
diff --git a/engines/mads/action.h b/engines/mads/action.h
index b38e9c24e0..3b238c997f 100644
--- a/engines/mads/action.h
+++ b/engines/mads/action.h
@@ -60,6 +60,12 @@ enum {
VERB_WALKTO = 13
};
+enum VerbType { VERB_ONLY, VERB_THIS, VERB_THAT };
+
+enum PrepType {
+ PREP_NONE, PREP_WITH, PREP_TO, PREP_AT, PREP_FROM, PREP_ON, PREP_IN,
+ PREP_UNDER, PREP_BEHIND, PREP_RELATIONAL = -1
+};
class MADSEngine;
@@ -91,7 +97,8 @@ private:
void startWalkingDirectly(int walkType);
public:
ActionDetails _action, _activeAction;
- int8 _flags1, _flags2;
+ VerbType _verbType;
+ PrepType _prepType;
int _commandSource;
int _mainObjectSource;
int _articleNumber;
diff --git a/engines/mads/inventory.cpp b/engines/mads/inventory.cpp
index 89ca9f84c2..607179a3c2 100644
--- a/engines/mads/inventory.cpp
+++ b/engines/mads/inventory.cpp
@@ -33,8 +33,8 @@ void InventoryObject::load(Common::SeekableReadStream &f) {
_vocabCount = f.readByte();
for (int i = 0; i < 3; ++i) {
- _vocabList[i]._actionFlags1 = f.readByte();
- _vocabList[i]._actionFlags2 = f.readByte();
+ _vocabList[i]._verbType = (VerbType)f.readByte();
+ _vocabList[i]._prepType = (PrepType)f.readByte();
_vocabList[i]._vocabId = f.readUint16LE();
}
@@ -71,7 +71,7 @@ void InventoryObjects::setQuality(int objIndex, int id, const byte *p) {
// more of the engine is implemented
for (int i = 0; i < (int)size(); ++i) {
InventoryObject &obj = (*this)[i];
- if (obj._vocabList[0]._actionFlags1 <= i)
+ if (obj._vocabList[0]._verbType <= i)
break;
if (obj._mutilateString[6 + i] == id) {
diff --git a/engines/mads/inventory.h b/engines/mads/inventory.h
index 13b81094af..5c2f925e57 100644
--- a/engines/mads/inventory.h
+++ b/engines/mads/inventory.h
@@ -41,8 +41,8 @@ public:
int _article;
int _vocabCount;
struct {
- int _actionFlags1;
- int _actionFlags2;
+ VerbType _verbType;
+ PrepType _prepType;
int _vocabId;
} _vocabList[3];
char _mutilateString[10]; // ???
diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp
index 76263bd0f6..02a066a0c6 100644
--- a/engines/mads/scene.cpp
+++ b/engines/mads/scene.cpp
@@ -50,16 +50,16 @@ Scene::Scene(MADSEngine *vm): _vm(vm), _action(_vm), _depthSurface(vm),
_layer = LAYER_GUI;
_lookFlag = false;
- _verbList.push_back(VerbInit(VERB_LOOK, 2, 0));
- _verbList.push_back(VerbInit(VERB_TAKE, 2, 0));
- _verbList.push_back(VerbInit(VERB_PUSH, 2, 0));
- _verbList.push_back(VerbInit(VERB_OPEN, 2, 0));
- _verbList.push_back(VerbInit(VERB_PUT, 1, -1));
- _verbList.push_back(VerbInit(VERB_TALKTO, 2, 0));
- _verbList.push_back(VerbInit(VERB_GIVE, 1, 2));
- _verbList.push_back(VerbInit(VERB_PULL, 2, 0));
- _verbList.push_back(VerbInit(VERB_CLOSE, 2, 0));
- _verbList.push_back(VerbInit(VERB_THROW, 1, 2));
+ _verbList.push_back(VerbInit(VERB_LOOK, VERB_THAT, PREP_NONE));
+ _verbList.push_back(VerbInit(VERB_TAKE, VERB_THAT, PREP_NONE));
+ _verbList.push_back(VerbInit(VERB_PUSH, VERB_THAT, PREP_NONE));
+ _verbList.push_back(VerbInit(VERB_OPEN, VERB_THAT, PREP_NONE));
+ _verbList.push_back(VerbInit(VERB_PUT, VERB_THIS, PREP_RELATIONAL));
+ _verbList.push_back(VerbInit(VERB_TALKTO, VERB_THAT, PREP_NONE));
+ _verbList.push_back(VerbInit(VERB_GIVE, VERB_THIS, PREP_TO));
+ _verbList.push_back(VerbInit(VERB_PULL, VERB_THAT, PREP_NONE));
+ _verbList.push_back(VerbInit(VERB_CLOSE, VERB_THAT, PREP_NONE));
+ _verbList.push_back(VerbInit(VERB_THROW, VERB_THIS, PREP_TO));
}
Scene::~Scene() {
diff --git a/engines/mads/scene_data.h b/engines/mads/scene_data.h
index 73ca21d092..e37aa43855 100644
--- a/engines/mads/scene_data.h
+++ b/engines/mads/scene_data.h
@@ -60,11 +60,12 @@ enum {
class VerbInit {
public:
int _id;
- int _action1;
- int _action2;
+ VerbType _verbType;
+ PrepType _prepType;
VerbInit() {}
- VerbInit(int id, int action1, int action2): _id(id), _action1(action1), _action2(action2) {}
+ VerbInit(int id, VerbType verbType, PrepType prepType): _id(id),
+ _verbType(verbType), _prepType(prepType) {}
};
class SceneLogic {