aboutsummaryrefslogtreecommitdiff
path: root/engines/dreamweb/object.cpp
diff options
context:
space:
mode:
authorMax Horn2011-12-15 10:54:28 +0100
committerMax Horn2011-12-15 13:44:40 +0100
commit719f3ec1789005186c4cb86b10effa9ceee93866 (patch)
treed33555eabf735e17b6931623cb913adb0aa1f6a2 /engines/dreamweb/object.cpp
parentee43bfed74f313115fc9cb537f614f26fa3d6fa2 (diff)
downloadscummvm-rg350-719f3ec1789005186c4cb86b10effa9ceee93866.tar.gz
scummvm-rg350-719f3ec1789005186c4cb86b10effa9ceee93866.tar.bz2
scummvm-rg350-719f3ec1789005186c4cb86b10effa9ceee93866.zip
DREAMWEB: Convert a bunch of stuff to C++
Specifically, I started with openOb() and withWhat() which allowed to remove offset_commandline and offset_openchangesize. A clean conversion of these required a conversion of printMessage2 and getOpenedSize.
Diffstat (limited to 'engines/dreamweb/object.cpp')
-rw-r--r--engines/dreamweb/object.cpp35
1 files changed, 32 insertions, 3 deletions
diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp
index 53d834e74c..8e5da2c90e 100644
--- a/engines/dreamweb/object.cpp
+++ b/engines/dreamweb/object.cpp
@@ -162,13 +162,13 @@ void DreamGenContext::examineOb(bool examineAgain) {
break;
}
case 1: {
- // NB: This table contains the non-constant openChangeSize!
+ // Note: This table contains the non-constant _openChangeSize!
RectWithCallback invList1[] = {
{ 273,320,157,198,&DreamGenContext::getBackFromOb },
{ 255,294,0,24,&DreamGenContext::dropObject },
{ kInventx+167,kInventx+167+(18*3),kInventy-18,kInventy-2,&DreamGenContext::incRyanPage },
- { kInventx, data.word(offset_openchangesize),kInventy+100,kInventy+100+kItempicsize,&DreamGenContext::useOpened },
- { kInventx,kInventx+(5*kItempicsize), kInventy,kInventy+(2*kItempicsize),&DreamGenContext::inToInv },
+ { kInventx,_openChangeSize,kInventy+100,kInventy+100+kItempicsize,&DreamGenContext::useOpened },
+ { kInventx,kInventx+(5*kItempicsize),kInventy,kInventy+(2*kItempicsize),&DreamGenContext::inToInv },
{ 0,320,0,200,&DreamGenContext::blank },
{ 0xFFFF,0,0,0,0 }
};
@@ -263,4 +263,33 @@ void DreamGenContext::getBackFromOb() {
blank();
}
+void DreamGenContext::getOpenedSize() {
+ ax = getOpenedSizeCPP();
+}
+
+byte DreamGenContext::getOpenedSizeCPP() {
+ byte obj = data.byte(kOpenedob);
+ switch (data.byte(kOpenedtype)) {
+ case 4:
+ return getExAd(obj)->b7;
+ case 2:
+ return getFreeAd(obj)->b7;
+ default:
+ return getSetAd(obj)->b3;
+ }
+}
+
+void DreamGenContext::openOb() {
+ uint8 commandLine[64] = "OBJECT NAME ONE ";
+
+ copyName(data.byte(kOpenedtype), data.byte(kOpenedob), commandLine);
+
+ printMessage(kInventx, kInventy+86, 62, 240, false);
+
+ al = printDirect(commandLine, data.word(kLastxpos) + 5, kInventy+86, 220, false);
+
+ fillOpen();
+ _openChangeSize = getOpenedSizeCPP() * kItempicsize + kInventx;
+}
+
} // End of namespace DreamGen