aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2011-12-08 15:21:42 +0100
committerWillem Jan Palenstijn2011-12-08 19:18:27 +0100
commit627d3f8d4128d07b01765132b8ee39ec7f30f2b6 (patch)
treeed049751922dcf9c777dbde781d7bf3698af80c0
parente40f1af3dcc282585cd8f9d173d81657ec4dc0cc (diff)
downloadscummvm-rg350-627d3f8d4128d07b01765132b8ee39ec7f30f2b6.tar.gz
scummvm-rg350-627d3f8d4128d07b01765132b8ee39ec7f30f2b6.tar.bz2
scummvm-rg350-627d3f8d4128d07b01765132b8ee39ec7f30f2b6.zip
DREAMWEB: Move functions to DreamBase
-rwxr-xr-xdevtools/tasmrecover/tasm-recover3
-rw-r--r--engines/dreamweb/dreambase.h32
-rw-r--r--engines/dreamweb/dreamgen.cpp47
-rw-r--r--engines/dreamweb/dreamgen.h5
-rw-r--r--engines/dreamweb/monitor.cpp30
-rw-r--r--engines/dreamweb/print.cpp6
-rw-r--r--engines/dreamweb/stubs.cpp32
-rw-r--r--engines/dreamweb/stubs.h43
-rw-r--r--engines/dreamweb/use.cpp13
9 files changed, 103 insertions, 108 deletions
diff --git a/devtools/tasmrecover/tasm-recover b/devtools/tasmrecover/tasm-recover
index 56d71094a8..9a319b9311 100755
--- a/devtools/tasmrecover/tasm-recover
+++ b/devtools/tasmrecover/tasm-recover
@@ -421,6 +421,8 @@ generator = cpp(context, "DreamGen", blacklist = [
'loadtemptext',
'loadtraveltext',
'lockeddoorway',
+ 'locklightoff',
+ 'locklighton',
'lockmon',
'look',
'loopchannel0',
@@ -496,6 +498,7 @@ generator = cpp(context, "DreamGen", blacklist = [
'pickupob',
'pitinterupt',
'pixelcheckset',
+ 'placefreeobject',
'placesetobject',
'playchannel0',
'playchannel1',
diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h
index d88fda397a..28feb5b975 100644
--- a/engines/dreamweb/dreambase.h
+++ b/engines/dreamweb/dreambase.h
@@ -53,6 +53,17 @@ public:
public:
// from monitor.cpp
void printOuterMon();
+ void showCurrentFile();
+ void accessLightOn();
+ void accessLightOff();
+ void turnOnPower();
+ void powerLightOn();
+ void powerLightOff();
+ void printLogo();
+ void scrollMonitor();
+ const char *monPrint(const char *string);
+ void lockLightOn();
+ void lockLightOff();
// from pathfind.cpp
Common::Point _lineData[200]; // Output of Bresenham
@@ -68,6 +79,10 @@ public:
uint8 printDirect(const uint8* string, uint16 x, uint16 y, uint8 maxWidth, bool centered);
uint8 getNumber(const Frame *charSet, const uint8 *string, uint16 maxWidth, bool centered, uint16 *offset);
uint8 kernChars(uint8 firstChar, uint8 secondChar, uint8 width);
+ uint8 printSlow(const uint8 *string, uint16 x, uint16 y, uint8 maxWidth, bool centered);
+ uint16 waitFrames();
+ void printCurs();
+ void delCurs();
// from sound.cpp
void volumeAdjust();
@@ -90,6 +105,8 @@ public:
void showBlink();
void dumpBlink();
void dumpPointer();
+ void showPointer();
+ void delPointer();
void showRyanPage();
Frame *tempGraphics();
Frame *tempGraphics2();
@@ -98,6 +115,21 @@ public:
void showOpBox();
void middlePanel();
void showDiary();
+ void readMouse();
+ uint16 readMouseState();
+ void hangOn(uint16 frameCount);
+ bool quitRequested();
+ void lockMon();
+ uint8 *textUnder();
+ void readKey();
+ void findOrMake(uint8 index, uint8 value, uint8 type);
+ DynObject *getFreeAd(uint8 index);
+ DynObject *getExAd(uint8 index);
+ DynObject *getEitherAdCPP();
+
+ // from use.cpp
+ void placeFreeObject(uint8 index);
+ void removeFreeObject(uint8 index);
// from vgafades.cpp
uint8 *mainPalette();
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index 6216714cae..9c1db94376 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -3661,40 +3661,6 @@ emptyinterface:
al = 0;
}
-void DreamGenContext::lockLightOn() {
- STACK_CHECK;
- di = 56;
- bx = 182;
- ds = data.word(kTempgraphics);
- al = 10;
- ah = 0;
- push(di);
- push(bx);
- showFrame();
- bx = pop();
- di = pop();
- cl = 12;
- ch = 8;
- multiDump();
-}
-
-void DreamGenContext::lockLightOff() {
- STACK_CHECK;
- di = 56;
- bx = 182;
- ds = data.word(kTempgraphics);
- al = 9;
- ah = 0;
- push(di);
- push(bx);
- showFrame();
- bx = pop();
- di = pop();
- cl = 12;
- ch = 8;
- multiDump();
-}
-
void DreamGenContext::makeCaps() {
STACK_CHECK;
_cmp(al, 'a');
@@ -5359,19 +5325,6 @@ void DreamGenContext::findPuzText() {
si = ax;
}
-void DreamGenContext::placeFreeObject() {
- STACK_CHECK;
- push(es);
- push(bx);
- cl = 0;
- ch = 1;
- findOrMake();
- getFreeAd();
- es.byte(bx+2) = 0;
- bx = pop();
- es = pop();
-}
-
void DreamGenContext::removeFreeObject() {
STACK_CHECK;
push(es);
diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h
index fa7fa79173..0fb145255f 100644
--- a/engines/dreamweb/dreamgen.h
+++ b/engines/dreamweb/dreamgen.h
@@ -593,15 +593,12 @@ public:
void removeObFromInv();
void heavy();
void useKey();
- void lockLightOn();
void discOps();
void monitorLogo();
void dirFile();
void pickupConts();
- void lockLightOff();
void allPalette();
void cantDrop();
- void placeFreeObject();
void putUnderZoom();
void findInvPos();
void workoutFrames();
@@ -641,7 +638,6 @@ public:
void findAllOpen();
void showSlots();
void findSetObject();
- void useDiary();
void deleteExObject();
void removeFreeObject();
void lookAtCard();
@@ -677,6 +673,7 @@ public:
void selectOpenOb();
void useGun();
void autoAppear();
+ void useDiary();
void newPlace();
void useHandle();
void showPuzText();
diff --git a/engines/dreamweb/monitor.cpp b/engines/dreamweb/monitor.cpp
index c6bfd487a3..49cd800b48 100644
--- a/engines/dreamweb/monitor.cpp
+++ b/engines/dreamweb/monitor.cpp
@@ -97,7 +97,7 @@ void DreamGenContext::useMon() {
workToScreenM();
}
-void DreamGenContext::printLogo() {
+void DreamBase::printLogo() {
showFrame(tempGraphics(), 56, 32, 0, 0);
showCurrentFile();
}
@@ -161,7 +161,7 @@ void DreamGenContext::delChar() {
multiDump(data.word(kMonadx), data.word(kMonady), al, 8);
}
-void DreamGenContext::printCurs() {
+void DreamBase::printCurs() {
uint16 x = data.word(kCurslocx);
uint16 y = data.word(kCurslocy);
uint16 height;
@@ -177,7 +177,7 @@ void DreamGenContext::printCurs() {
multiDump(x - 6, y, 12, height);
}
-void DreamGenContext::delCurs() {
+void DreamBase::delCurs() {
uint16 x = data.word(kCurslocx);
uint16 y = data.word(kCurslocy);
uint16 width = 6;
@@ -195,14 +195,14 @@ void DreamGenContext::hangOnCurs() {
hangOnCurs(cx);
}
-void DreamGenContext::scrollMonitor() {
+void DreamBase::scrollMonitor() {
printLogo();
printUnderMon();
workToScreenCPP();
playChannel1(25);
}
-void DreamGenContext::showCurrentFile() {
+void DreamBase::showCurrentFile() {
uint16 x = 178; // TODO: Looks like this hardcoded constant in the asm doesn't match the frame
const char *currentFile = (const char *)data.ptr(kCurrentfile+1, 0);
while (*currentFile) {
@@ -212,12 +212,12 @@ void DreamGenContext::showCurrentFile() {
}
}
-void DreamGenContext::accessLightOn() {
+void DreamBase::accessLightOn() {
showFrame(tempGraphics(), 74, 182, 8, 0);
multiDump(74, 182, 12, 8);
}
-void DreamGenContext::accessLightOff() {
+void DreamBase::accessLightOff() {
showFrame(tempGraphics(), 74, 182, 7, 0);
multiDump(74, 182, 12, 8);
}
@@ -258,17 +258,27 @@ void DreamGenContext::netError() {
scrollMonitor();
}
-void DreamGenContext::powerLightOn() {
+void DreamBase::powerLightOn() {
showFrame(tempGraphics(), 257+4, 182, 6, 0);
multiDump(257+4, 182, 12, 8);
}
-void DreamGenContext::powerLightOff() {
+void DreamBase::powerLightOff() {
showFrame(tempGraphics(), 257+4, 182, 5, 0);
multiDump(257+4, 182, 12, 8);
}
-void DreamGenContext::turnOnPower() {
+void DreamBase::lockLightOn() {
+ showFrame(tempGraphics(), 56, 182, 10, 0);
+ multiDump(58, 182, 12, 8);
+}
+
+void DreamBase::lockLightOff() {
+ showFrame(tempGraphics(), 56, 182, 9, 0);
+ multiDump(58, 182, 12, 8);
+}
+
+void DreamBase::turnOnPower() {
for (size_t i = 0; i < 3; ++i) {
powerLightOn();
hangOn(30);
diff --git a/engines/dreamweb/print.cpp b/engines/dreamweb/print.cpp
index c554053fb7..df89df28ef 100644
--- a/engines/dreamweb/print.cpp
+++ b/engines/dreamweb/print.cpp
@@ -79,7 +79,7 @@ void DreamBase::printChar(const Frame *charSet, uint16 x, uint16 y, uint8 c, uin
printChar(charSet, &x, y, c, nextChar, width, height);
}
-uint8 DreamGenContext::printSlow(const uint8 *string, uint16 x, uint16 y, uint8 maxWidth, bool centered) {
+uint8 DreamBase::printSlow(const uint8 *string, uint16 x, uint16 y, uint8 maxWidth, bool centered) {
data.byte(kPointerframe) = 1;
data.byte(kPointermode) = 3;
const Frame* charSet = (const Frame *)getSegment(data.word(kCharset1)).ptr(0, 0);
@@ -205,7 +205,7 @@ uint8 DreamBase::kernChars(uint8 firstChar, uint8 secondChar, uint8 width) {
return width;
}
-uint16 DreamGenContext::waitFrames() {
+uint16 DreamBase::waitFrames() {
readMouse();
showPointer();
vSync();
@@ -221,7 +221,7 @@ void DreamGenContext::monPrint() {
bx = originalBx + (nextString - string);
}
-const char *DreamGenContext::monPrint(const char *string) {
+const char *DreamBase::monPrint(const char *string) {
data.byte(kKerning) = 1;
uint16 x = data.word(kMonadx);
Frame *charset = engine->tempCharset();
diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index 4ccb50ba6c..48cf3d86f4 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -645,7 +645,7 @@ done: // The engine will need some cleaner finalization, let's put it here for n
engine->freeIcons2();
}
-bool DreamGenContext::quitRequested() {
+bool DreamBase::quitRequested() {
return data.byte(kQuitrequested);
}
@@ -738,7 +738,7 @@ void DreamGenContext::switchRyanOff() {
data.byte(kRyanon) = 1;
}
-uint8 *DreamGenContext::textUnder() {
+uint8 *DreamBase::textUnder() {
return getSegment(data.word(kBuffers)).ptr(kTextunder, 0);
}
@@ -838,13 +838,13 @@ bool DreamGenContext::openForLoad(unsigned int slot) {
return engine->openSaveFileForReading(filename);
}
-void DreamGenContext::readMouse() {
+void DreamBase::readMouse() {
data.word(kOldbutton) = data.word(kMousebutton);
uint16 state = readMouseState();
data.word(kMousebutton) = state;
}
-uint16 DreamGenContext::readMouseState() {
+uint16 DreamBase::readMouseState() {
data.word(kOldx) = data.word(kMousex);
data.word(kOldy) = data.word(kMousey);
uint16 x, y, state;
@@ -1057,7 +1057,7 @@ void DreamGenContext::eraseOldObs() {
}
}
-void DreamGenContext::lockMon() {
+void DreamBase::lockMon() {
// Pressing space pauses text output in the monitor. We use the "hard"
// key because calling readkey() drains characters from the input
// buffer, we we want the user to be able to type ahead while the text
@@ -1176,12 +1176,10 @@ void DreamGenContext::dealWithSpecial(uint8 firstParam, uint8 secondParam) {
removeSetObject(secondParam);
data.byte(kHavedoneobs) = 1;
} else if (type == 2) {
- al = secondParam;
- placeFreeObject();
+ placeFreeObject(secondParam);
data.byte(kHavedoneobs) = 1;
} else if (type == 3) {
- al = secondParam;
- removeFreeObject();
+ removeFreeObject(secondParam);
data.byte(kHavedoneobs) = 1;
} else if (type == 4) {
switchRyanOff();
@@ -1391,7 +1389,7 @@ void DreamGenContext::findOrMake() {
findOrMake(b0, b2, b3);
}
-void DreamGenContext::findOrMake(uint8 index, uint8 value, uint8 type) {
+void DreamBase::findOrMake(uint8 index, uint8 value, uint8 type) {
Change *change = (Change *)getSegment(data.word(kBuffers)).ptr(kListofchanges, sizeof(Change));
for (; change->index != 0xff; ++change) {
if (index == change->index && data.byte(kReallocation) == change->location && type == change->type) {
@@ -1413,15 +1411,15 @@ void DreamGenContext::setAllChanges() {
doChange(change->index, change->value, change->type);
}
-DynObject *DreamGenContext::getFreeAd(uint8 index) {
+DynObject *DreamBase::getFreeAd(uint8 index) {
return (DynObject *)getSegment(data.word(kFreedat)).ptr(0, 0) + index;
}
-DynObject *DreamGenContext::getExAd(uint8 index) {
+DynObject *DreamBase::getExAd(uint8 index) {
return (DynObject *)getSegment(data.word(kExtras)).ptr(kExdata, 0) + index;
}
-DynObject *DreamGenContext::getEitherAdCPP() {
+DynObject *DreamBase::getEitherAdCPP() {
if (data.byte(kObjecttype) == 4)
return getExAd(data.byte(kItemframe));
else
@@ -1625,7 +1623,7 @@ void DreamGenContext::obName(uint8 command, uint8 commandType) {
}
}
-void DreamGenContext::delPointer() {
+void DreamBase::delPointer() {
if (data.word(kOldpointerx) == 0xffff)
return;
data.word(kDelherex) = data.word(kOldpointerx);
@@ -1759,7 +1757,7 @@ void DreamGenContext::checkCoords(const RectWithCallback *rectWithCallbacks) {
}
}
-void DreamGenContext::showPointer() {
+void DreamBase::showPointer() {
showBlink();
uint16 x = data.word(kMousex);
data.word(kOldpointerx) = data.word(kMousex);
@@ -1962,7 +1960,7 @@ void DreamGenContext::hangOn() {
hangOn(cx);
}
-void DreamGenContext::hangOn(uint16 frameCount) {
+void DreamBase::hangOn(uint16 frameCount) {
while (frameCount) {
vSync();
--frameCount;
@@ -2912,7 +2910,7 @@ void DreamGenContext::showSymbol() {
showFrame(tempGraphics(), data.byte(kSymbolbotx) + kSymbolx+54, kSymboly+49, 6 + nextNextBotSymbol, 32);
}
-void DreamGenContext::readKey() {
+void DreamBase::readKey() {
uint16 bufOut = data.word(kBufferout);
if (bufOut == data.word(kBufferin)) {
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h
index 80433c1134..f1dd99811b 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -23,14 +23,12 @@
#define DREAMWEB_STUBS_H
void screenUpdate();
- bool quitRequested();
void startup();
void startup1();
void switchRyanOn();
void switchRyanOff();
uint16 allocateMem(uint16 paragraphs);
void deallocateMem(uint16 segment);
- uint8 *textUnder();
uint16 standardLoad(const char *fileName, uint16 *outSizeInBytes = NULL); // Returns a segment handle which needs to be freed with deallocatemem for symmetry
void *standardLoadCPP(const char *fileName, uint16 *outSizeInBytes = NULL); // And this one should be 'free'd
void loadIntoTemp();
@@ -40,8 +38,6 @@
void loadTempCharset();
void loadTempCharset(const char *fileName);
void saveLoad();
- void printCurs();
- void delCurs();
void delChar();
void hangOnCurs(uint16 frameCount);
void hangOnCurs();
@@ -80,7 +76,6 @@
void setupTimedTemp(uint8 textIndex, uint8 voiceIndex, uint8 x, uint8 y, uint16 countToTimed, uint16 timeCount);
void getUnderTimed();
void putUnderTimed();
- uint8 printSlow(const uint8 *string, uint16 x, uint16 y, uint8 maxWidth, bool centered);
void dumpTextLine();
void oldToNames();
void namesToOld();
@@ -126,7 +121,6 @@
void turnAnyPathOn();
void turnAnyPathOff();
void makeBackOb(SetObject *objData);
- void lockMon();
void dealWithSpecial(uint8 firstParam, uint8 secondParam);
void zoom();
void showRain();
@@ -169,9 +163,15 @@
void personNameText();
void findXYFromPath();
void findOrMake();
- void findOrMake(uint8 index, uint8 value, uint8 type);
- DynObject *getFreeAd(uint8 index);
- DynObject *getExAd(uint8 index);
+ void findOrMake(uint8 index, uint8 value, uint8 type) {
+ DreamBase::findOrMake(index, value, type);
+ }
+ DynObject *getFreeAd(uint8 index) {
+ return DreamBase::getFreeAd(index);
+ }
+ DynObject *getExAd(uint8 index) {
+ return DreamBase::getExAd(index);
+ }
DynObject *getEitherAdCPP();
SetObject *getSetAd(uint8 index);
void *getAnyAd(uint8 *value1, uint8 *value2);
@@ -195,14 +195,9 @@
void walkAndExamine();
void obName();
void obName(uint8 command, uint8 commandType);
- void delPointer();
- void showPointer();
void animPointer();
void checkCoords();
void checkCoords(const RectWithCallback *rectWithCallbacks);
- void readMouse();
- uint16 readMouseState();
- uint16 waitFrames();
void drawFlags();
void addToPeopleList();
void addToPeopleList(ReelRoutine *routine);
@@ -229,7 +224,9 @@
void fillRyan();
void useRoutine();
void hangOn();
- void hangOn(uint16 frameCount);
+ void hangOn(uint16 frameCount) {
+ DreamBase::hangOn(frameCount);
+ }
void hangOnW();
void hangOnW(uint16 frameCount);
void hangOnP();
@@ -271,27 +268,21 @@
void readSetData();
void fadeupYellows();
void fadeupMonFirst();
- void printLogo();
void loadMenu();
void showMenu();
void dumpMenu();
void useMenu();
void useMon();
- void scrollMonitor();
- void showCurrentFile();
void input();
void monPrint();
- const char *monPrint(const char *string);
- void accessLightOn();
- void accessLightOff();
+ const char *monPrint(const char *string) {
+ return DreamBase::monPrint(string);
+ }
void randomAccess(uint16 count);
void randomAccess();
void monMessage(uint8 index);
void monMessage();
void netError();
- void turnOnPower();
- void powerLightOn();
- void powerLightOff();
void playChannel0();
void playChannel0(uint8 index, uint8 repeat) {
DreamBase::playChannel0(index, repeat);
@@ -471,7 +462,6 @@
void loadPersonal();
void loadNews();
void loadCart();
- void readKey();
void hangOne(uint16 delay);
void hangOne();
void bibleQuote();
@@ -558,5 +548,8 @@
void watchReel();
void showWatchReel();
void plotReel(uint16 &reelPointer);
+ void removeFreeObject(uint8 index) {
+ DreamBase::removeFreeObject(index);
+ }
#endif
diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp
index b56ae07864..f06a30d81e 100644
--- a/engines/dreamweb/use.cpp
+++ b/engines/dreamweb/use.cpp
@@ -829,8 +829,7 @@ void DreamGenContext::usePlate() {
placeSetObject(28);
placeSetObject(24);
removeSetObject(25);
- al = 0;
- placeFreeObject();
+ placeFreeObject(0);
data.byte(kProgresspoints)++;
data.byte(kGetback) = 1;
} else if (compare(data.byte(kWithobject), data.byte(kWithtype), knife)) {
@@ -1150,4 +1149,14 @@ void DreamGenContext::useCooker() {
putBackObStuff();
}
+void DreamBase::placeFreeObject(uint8 index) {
+ findOrMake(index, 0, 1);
+ getFreeAd(index)->mapad[0] = 0;
+}
+
+void DreamBase::removeFreeObject(uint8 index) {
+ getFreeAd(index)->mapad[0] = 0xFF;
+}
+
+
} // End of namespace DreamGen