aboutsummaryrefslogtreecommitdiff
path: root/engines/m4
diff options
context:
space:
mode:
authorPaul Gilbert2010-03-19 09:19:23 +0000
committerPaul Gilbert2010-03-19 09:19:23 +0000
commitb2b7a08cc2a502e0f6f9ec98afd85f30bdc529ab (patch)
tree931bb2cd66243101a0aab3b12740c016a14ec9ad /engines/m4
parent412e63123e14e4bb838c9b1b8f7596ca53201f9f (diff)
downloadscummvm-rg350-b2b7a08cc2a502e0f6f9ec98afd85f30bdc529ab.tar.gz
scummvm-rg350-b2b7a08cc2a502e0f6f9ec98afd85f30bdc529ab.tar.bz2
scummvm-rg350-b2b7a08cc2a502e0f6f9ec98afd85f30bdc529ab.zip
Beginnings of hooking up the new logic for current action display
svn-id: r48298
Diffstat (limited to 'engines/m4')
-rw-r--r--engines/m4/console.cpp4
-rw-r--r--engines/m4/globals.cpp3
-rw-r--r--engines/m4/globals.h3
-rw-r--r--engines/m4/m4_scene.h2
-rw-r--r--engines/m4/mads_scene.h1
-rw-r--r--engines/m4/mads_views.cpp46
-rw-r--r--engines/m4/scene.h1
7 files changed, 37 insertions, 23 deletions
diff --git a/engines/m4/console.cpp b/engines/m4/console.cpp
index 49685c934f..0c2e80df0e 100644
--- a/engines/m4/console.cpp
+++ b/engines/m4/console.cpp
@@ -330,8 +330,8 @@ bool MadsConsole::cmdObject(int argc, const char **argv) {
DebugPrintf(" - ");
for (int i = 0; i < obj->vocabCount; ++i) {
if (i != 0) DebugPrintf(", ");
- DebugPrintf("%s (%d)/%d", _vm->globals()->getVocab(obj->vocabList[i].vocabId),
- obj->vocabList[i].vocabId, obj->vocabList[i].unk);
+ DebugPrintf("%s (%d)/%d,%d", _vm->globals()->getVocab(obj->vocabList[i].vocabId),
+ obj->vocabList[i].vocabId, obj->vocabList[i].flags1, obj->vocabList[i].flags2);
}
}
DebugPrintf("\n");
diff --git a/engines/m4/globals.cpp b/engines/m4/globals.cpp
index 1ce2f24658..a46fe810ae 100644
--- a/engines/m4/globals.cpp
+++ b/engines/m4/globals.cpp
@@ -527,7 +527,8 @@ void MadsObject::load(Common::SeekableReadStream *stream) {
assert(vocabCount <= 3);
for (int i = 0; i < vocabCount; ++i) {
- vocabList[i].unk = READ_LE_UINT16(&obj[6 + i * 4]);
+ vocabList[i].flags1 = obj[6 + i * 4];
+ vocabList[i].flags2 = obj[7 + i * 4];
vocabList[i].vocabId = READ_LE_UINT16(&obj[8 + i * 4]);
}
}
diff --git a/engines/m4/globals.h b/engines/m4/globals.h
index 6349376643..34d11c10ac 100644
--- a/engines/m4/globals.h
+++ b/engines/m4/globals.h
@@ -166,7 +166,8 @@ enum MADSArticles {
};
struct VocabEntry {
- uint16 unk;
+ uint8 flags1;
+ uint8 flags2;
uint16 vocabId;
};
diff --git a/engines/m4/m4_scene.h b/engines/m4/m4_scene.h
index 846c1a2ff8..25546fe491 100644
--- a/engines/m4/m4_scene.h
+++ b/engines/m4/m4_scene.h
@@ -72,7 +72,6 @@ public:
virtual void checkHotspotAtMousePos(int x, int y);
virtual void leftClick(int x, int y);
virtual void rightClick(int x, int y);
- virtual void setAction(int action, int objectId = -1);
virtual void update();
virtual void showHotSpots();
@@ -80,6 +79,7 @@ public:
M4InterfaceView *getInterface() { return (M4InterfaceView *)_interfaceSurface; };
M4SceneResources &getSceneResources() { return _sceneResources; };
void setStatusText(const char *text);
+ void setAction(int action, int objectId = -1);
};
} // End of namespace M4
diff --git a/engines/m4/mads_scene.h b/engines/m4/mads_scene.h
index 2f8fcf990b..4a157409c1 100644
--- a/engines/m4/mads_scene.h
+++ b/engines/m4/mads_scene.h
@@ -207,6 +207,7 @@ public:
MadsInterfaceView *getInterface() { return (MadsInterfaceView *)_interfaceSurface; };
MadsSceneResources &getSceneResources() { return _sceneResources; };
+ MadsAction &getAction() { return _action; }
void setStatusText(const char *text) {};//***DEPRECATED***
};
diff --git a/engines/m4/mads_views.cpp b/engines/m4/mads_views.cpp
index c06a8de513..66d1a5e767 100644
--- a/engines/m4/mads_views.cpp
+++ b/engines/m4/mads_views.cpp
@@ -249,6 +249,8 @@ void MadsInterfaceView::onRefresh(RectList *rects, M4Surface *destSurface) {
}
bool MadsInterfaceView::onEvent(M4EventType eventType, int32 param1, int x, int y, bool &captureEvents) {
+ MadsAction &act = _madsVm->scene()->getAction();
+
// If the mouse isn't being held down, then reset the repeated scroll timer
if (eventType != MEVENT_LEFT_HOLD)
_nextScrollerTicks = 0;
@@ -270,25 +272,35 @@ bool MadsInterfaceView::onEvent(M4EventType eventType, int32 param1, int x, int
case MEVENT_LEFT_CLICK:
// Left mouse click
- // Check if an inventory object was selected
- if ((_highlightedElement >= INVLIST_START) && (_highlightedElement < (INVLIST_START + 5))) {
- // Ensure there is an inventory item listed in that cell
- uint idx = _highlightedElement - INVLIST_START;
- if ((_topIndex + idx) < _inventoryList.size()) {
- // Set the selected object
- setSelectedObject(_inventoryList[_topIndex + idx]);
+ {
+ // Check if an inventory object was selected
+ if ((_highlightedElement >= INVLIST_START) && (_highlightedElement < (INVLIST_START + 5))) {
+ // Ensure there is an inventory item listed in that cell
+ uint idx = _highlightedElement - INVLIST_START;
+ if ((_topIndex + idx) < _inventoryList.size()) {
+ // Set the selected object
+ setSelectedObject(_inventoryList[_topIndex + idx]);
+ }
+ } else if ((_highlightedElement >= ACTIONS_START) && (_highlightedElement < (ACTIONS_START + 10))) {
+ // A standard action was selected
+ int verbId = kVerbLook + (_highlightedElement - ACTIONS_START);
+ warning("Selected action #%d", verbId);
+
+ } else if ((_highlightedElement >= VOCAB_START) && (_highlightedElement < (VOCAB_START + 5))) {
+ // A vocab action was selected
+ MadsObject *obj = _madsVm->globals()->getObject(_selectedObject);
+ int vocabIndex = MIN(_highlightedElement - VOCAB_START, obj->vocabCount - 1);
+ if (vocabIndex >= 0) {
+ act._actionMode = ACTMODE_OBJECT;
+ act._actionMode2 = ACTMODE2_2;
+ act._flags1 = obj->vocabList[1].flags1;
+ act._flags2 = obj->vocabList[1].flags2;
+
+ act._currentHotspot = _selectedObject;
+ act._articleNumber = act._flags2;
+ }
}
- } else if ((_highlightedElement >= ACTIONS_START) && (_highlightedElement < (ACTIONS_START + 10))) {
- // A standard action was selected
- _vm->_scene->setAction(kVerbLook + (_highlightedElement - ACTIONS_START));
- } else if ((_highlightedElement >= VOCAB_START) && (_highlightedElement < (VOCAB_START + 5))) {
- // A vocab action was selected
- MadsObject *obj = _madsVm->globals()->getObject(_selectedObject);
- int vocabIndex = MIN(_highlightedElement - VOCAB_START, obj->vocabCount - 1);
- if (vocabIndex >= 0)
- _vm->_scene->setAction(obj->vocabList[vocabIndex].vocabId, _selectedObject);
}
-
return true;
case MEVENT_LEFT_HOLD:
diff --git a/engines/m4/scene.h b/engines/m4/scene.h
index d232c16974..be383605ec 100644
--- a/engines/m4/scene.h
+++ b/engines/m4/scene.h
@@ -100,7 +100,6 @@ public:
virtual void checkHotspotAtMousePos(int x, int y) = 0;
virtual void leftClick(int x, int y) = 0;
virtual void rightClick(int x, int y) = 0;
- virtual void setAction(int action, int objectId = -1) = 0;
virtual void update() = 0;
virtual void showHotSpots();