aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/m4/globals.cpp9
-rw-r--r--engines/m4/globals.h2
-rw-r--r--engines/m4/mads_logic.cpp41
3 files changed, 52 insertions, 0 deletions
diff --git a/engines/m4/globals.cpp b/engines/m4/globals.cpp
index f4aab8ae8f..7a0b776eb8 100644
--- a/engines/m4/globals.cpp
+++ b/engines/m4/globals.cpp
@@ -380,6 +380,15 @@ void MadsGlobals::loadMadsObjects() {
_vm->res()->toss("objects.dat");
}
+int MadsGlobals::getObjectIndex(uint16 descId) {
+ for (uint i = 0; i < _madsObjects.size(); ++i) {
+ if (_madsObjects[i].get()->_descId == descId)
+ return i;
+ }
+
+ return -1;
+}
+
int MadsGlobals::messageIndexOf(uint32 messageId) {
for (uint i = 0; i < _madsMessages.size(); ++i)
{
diff --git a/engines/m4/globals.h b/engines/m4/globals.h
index ae2941c169..693dc9d6c9 100644
--- a/engines/m4/globals.h
+++ b/engines/m4/globals.h
@@ -297,6 +297,8 @@ public:
void loadMadsObjects();
uint32 getObjectsSize() { return _madsObjects.size(); }
MadsObject *getObject(uint32 index) { return _madsObjects[index].get(); }
+ int getObjectIndex(uint16 descId);
+ int getObjectFolder(uint32 folderId) { warning("TODO: getObjectFolder"); return -1; }
void addVisitedScene(int sceneNumber);
bool isSceneVisited(int sceneNumber);
diff --git a/engines/m4/mads_logic.cpp b/engines/m4/mads_logic.cpp
index cc28a26e68..335127393e 100644
--- a/engines/m4/mads_logic.cpp
+++ b/engines/m4/mads_logic.cpp
@@ -199,6 +199,10 @@ uint32 MadsSceneLogic::getDataValue(int dataId) {
return getActiveAnimationBool();
case 11:
return getAnimationCurrentFrame();
+ case 12:
+ return _madsVm->scene()->_action._inProgress;
+ case 13:
+ return _madsVm->globals()->_difficultyLevel;
default:
// All other data variables get stored in the hash table
return _madsVm->globals()->_dataMap[dataId];
@@ -239,6 +243,12 @@ void MadsSceneLogic::setDataValue(int dataId, uint16 dataValue) {
case 11:
error("Tried to set read only data field %d", dataId);
break;
+ case 12:
+ _madsVm->scene()->_action._inProgress = dataValue != 0;
+ break;
+ case 13:
+ _madsVm->globals()->_difficultyLevel = dataValue;
+ break;
default:
// All other data variables get stored in the hash table
_madsVm->globals()->_dataMap[dataId] = dataValue;
@@ -986,6 +996,37 @@ void MadsSceneLogic::callSubroutine(int subIndex, Common::Stack<ScriptVar> &stac
break;
}
+ case 27: {
+ // object_get_id_from_desc
+ EXTRACT_PARAMS(1);
+ stack.push(_madsVm->globals()->getObjectIndex(p[0]));
+ break;
+ }
+
+ case 28: {
+ // object_get_folder
+ EXTRACT_PARAMS(1);
+ stack.push(_madsVm->globals()->getObjectFolder(p[0]));
+ break;
+ }
+
+ case 29:
+ // inventory_remove
+ EXTRACT_PARAMS(1);
+ _madsVm->scene()->getInterface()->addObjectToInventory(p[0]);
+ break;
+
+ case 30:
+ // image_inter_list_call
+ EXTRACT_PARAMS(1);
+ warning("TODO: image_inter_list_call");
+ break;
+
+ case 31:
+ // dialog_flags_show
+ warning("todo: dialog_flags_show");
+ break;
+
default:
error("Unknown subroutine %d called", subIndex);
break;