diff options
author | Bertrand Augereau | 2011-08-31 11:24:34 +0200 |
---|---|---|
committer | Bertrand Augereau | 2011-08-31 15:15:26 +0200 |
commit | cd5af89557d458e4eef1fd8b0b23c865ce6de3fe (patch) | |
tree | f2bb24038930958c8f7274c6c9b229c32d4725ed /engines | |
parent | cee156d5963a2eae868cf4d93ebca57d8cdb2b83 (diff) | |
download | scummvm-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.h | 5 | ||||
-rw-r--r-- | engines/dreamweb/stubs.cpp | 16 | ||||
-rw-r--r-- | engines/dreamweb/stubs.h | 1 |
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); |