aboutsummaryrefslogtreecommitdiff
path: root/engines/dreamweb/object.cpp
diff options
context:
space:
mode:
authorFilippos Karapetis2011-12-18 11:25:49 +0200
committerFilippos Karapetis2011-12-18 11:26:19 +0200
commit421c8cd2624a9e8ac2f0091ef1b51b42f99dae26 (patch)
treeaaa8083b181a16ab1a92f7b9464f19005070c155 /engines/dreamweb/object.cpp
parentf69dfba21a5d4be8cc60a20a0dd0628717fa5373 (diff)
downloadscummvm-rg350-421c8cd2624a9e8ac2f0091ef1b51b42f99dae26.tar.gz
scummvm-rg350-421c8cd2624a9e8ac2f0091ef1b51b42f99dae26.tar.bz2
scummvm-rg350-421c8cd2624a9e8ac2f0091ef1b51b42f99dae26.zip
DREAMWEB: Port 'setpickup' to C++ and added an enum for the object types
Diffstat (limited to 'engines/dreamweb/object.cpp')
-rw-r--r--engines/dreamweb/object.cpp59
1 files changed, 55 insertions, 4 deletions
diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp
index e4abac14f2..4daa5091a5 100644
--- a/engines/dreamweb/object.cpp
+++ b/engines/dreamweb/object.cpp
@@ -108,10 +108,10 @@ void DreamBase::obToInv(uint8 index, uint8 flag, uint16 x, uint16 y) {
}
void DreamBase::obPicture() {
- if (data.byte(kObjecttype) == 1)
+ if (data.byte(kObjecttype) == kSetObjectType1)
return;
Frame *frames;
- if (data.byte(kObjecttype) == 4)
+ if (data.byte(kObjecttype) == kExObjectType)
frames = (Frame *)getSegment(data.word(kExtras)).ptr(0, 0);
else
frames = (Frame *)getSegment(data.word(kFreeframes)).ptr(0, 0);
@@ -133,6 +133,7 @@ void DreamBase::obIcons() {
void DreamGenContext::examineOb(bool examineAgain) {
data.byte(kPointermode) = 0;
data.word(kTimecount) = 0;
+
while (true) {
if (examineAgain) {
data.byte(kInmaparea) = 0;
@@ -140,8 +141,7 @@ void DreamGenContext::examineOb(bool examineAgain) {
data.byte(kOpenedob) = 255;
data.byte(kOpenedtype) = 255;
data.byte(kInvopen) = 0;
- al = data.byte(kCommandtype);
- data.byte(kObjecttype) = al;
+ data.byte(kObjecttype) = data.byte(kCommandtype);
data.byte(kItemframe) = 0;
data.byte(kPointerframe) = 0;
createPanel();
@@ -167,6 +167,7 @@ void DreamGenContext::examineOb(bool examineAgain) {
dumpTextLine();
delPointer();
data.byte(kGetback) = 0;
+
switch (data.byte(kInvopen)) {
case 0: {
RectWithCallback examList[] = {
@@ -207,6 +208,7 @@ void DreamGenContext::examineOb(bool examineAgain) {
break;
}
}
+
if (data.byte(kQuitrequested) != 0)
break;
if (data.byte(kExamagain) != 0)
@@ -426,4 +428,53 @@ void DreamGenContext::selectOb() {
}
}
+void DreamGenContext::setPickup() {
+ if (data.byte(kObjecttype) != kSetObjectType1 && data.byte(kObjecttype) != kSetObjectType3) {
+ // The original called getAnyAd() here. However, since object types
+ // 1 and 3 are excluded, the resulting object is a DynObject, so
+ // we can use getEitherAd() instead.
+ DynObject *object = getEitherAdCPP();
+ if (object->mapad[0] == 4) {
+ blank();
+ return;
+ }
+ } else {
+ blank();
+ return;
+ }
+
+ if (data.byte(kCommandtype) != 209) {
+ data.byte(kCommandtype) = 209;
+ commandWithOb(33, data.byte(kObjecttype), data.byte(kCommand));
+ }
+
+ if (data.word(kMousebutton) == 1 && data.word(kMousebutton) == data.word(kOldbutton))
+ return;
+
+ createPanel();
+ showPanel();
+ showMan();
+ showExit();
+ examIcon();
+ data.byte(kPickup) = 1;
+ data.byte(kInvopen) = 2;
+
+ if (data.byte(kObjecttype) != kExObjectType) {
+ data.byte(kItemframe) = data.byte(kCommand);
+ data.byte(kOpenedob) = 255;
+ transferToEx();
+ data.byte(kItemframe) = data.byte(kCommand);
+ data.byte(kObjecttype) = kExObjectType;
+ DynObject *object = getEitherAdCPP();
+ object->mapad[0] = 20;
+ object->mapad[1] = 255;
+ } else {
+ data.byte(kItemframe) = data.byte(kCommand);
+ data.byte(kOpenedob) = 255;
+ }
+
+ openInv();
+ workToScreenM();
+}
+
} // End of namespace DreamGen