aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorBertrand Augereau2011-08-31 11:24:34 +0200
committerBertrand Augereau2011-08-31 15:15:26 +0200
commitcd5af89557d458e4eef1fd8b0b23c865ce6de3fe (patch)
treef2bb24038930958c8f7274c6c9b229c32d4725ed /engines
parentcee156d5963a2eae868cf4d93ebca57d8cdb2b83 (diff)
downloadscummvm-rg350-cd5af89557d458e4eef1fd8b0b23c865ce6de3fe.tar.gz
scummvm-rg350-cd5af89557d458e4eef1fd8b0b23c865ce6de3fe.tar.bz2
scummvm-rg350-cd5af89557d458e4eef1fd8b0b23c865ce6de3fe.zip
DREAMWEB: 'getanyad' ported to C++
Diffstat (limited to 'engines')
-rw-r--r--engines/dreamweb/structs.h5
-rw-r--r--engines/dreamweb/stubs.cpp16
-rw-r--r--engines/dreamweb/stubs.h1
3 files changed, 22 insertions, 0 deletions
diff --git a/engines/dreamweb/structs.h b/engines/dreamweb/structs.h
index 9b8d823491..9f7c23181c 100644
--- a/engines/dreamweb/structs.h
+++ b/engines/dreamweb/structs.h
@@ -77,6 +77,8 @@ struct SetObject {
uint8 b3;
uint8 b4;
uint8 priority;
+ uint16 w4() const { return READ_LE_UINT16(&b4); }
+ void setW4(uint16 v) { WRITE_LE_UINT16(&b4, v); }
uint8 b6;
uint8 delay;
uint8 type;
@@ -124,6 +126,9 @@ struct DynObject {
uint8 mapad[5];
uint8 b7;
uint8 b8;
+ uint16 w7() const { return READ_LE_UINT16(&b7); }
+ void setW7(uint16 v) { WRITE_LE_UINT16(&b7, v); }
+
uint8 b9;
uint8 b10;
uint8 initialLocation;
diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index 35f9df0a43..88e590f4a3 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -1188,6 +1188,22 @@ DynObject *DreamGenContext::geteitheradCPP() {
return getfreead(data.byte(kItemframe));
}
+void *DreamGenContext::getanyad(uint16 *value) {
+ if (data.byte(kObjecttype) == 4) {
+ DynObject *exObject = getexad(data.byte(kCommand));
+ *value = exObject->w7();
+ return exObject;
+ } else if (data.byte(kObjecttype) == 2) {
+ DynObject *freeObject = getfreead(data.byte(kCommand));
+ *value = freeObject->w7();
+ return freeObject;
+ } else {
+ SetObject *setObject = getsetad(data.byte(kCommand));
+ *value = setObject->w4(); // Suspicious : conflicts with priority being a byte?
+ return setObject;
+ }
+}
+
SetObject *DreamGenContext::getsetad(uint8 index) {
return (SetObject *)segRef(data.word(kSetdat)).ptr(0, 0) + index;
}
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h
index f137707220..ac68da850a 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -162,6 +162,7 @@
DynObject *getexad(uint8 index);
DynObject *geteitheradCPP();
SetObject *getsetad(uint8 index);
+ void *getanyad(uint16 *value);
void setallchanges();
void dochange();
void dochange(uint8 index, uint8 value, uint8 type);