From 9972fc613adf7a9f751163724a08ac9bcd5ef7b0 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Thu, 15 Dec 2011 12:23:00 +0100 Subject: DREAMWEB: Move more methods to DreamBase --- engines/dreamweb/backdrop.cpp | 2 +- engines/dreamweb/dreambase.h | 38 ++++++++++++++++++++++++++++++++++ engines/dreamweb/keypad.cpp | 48 +++++++++++++++++++++---------------------- engines/dreamweb/stubs.cpp | 22 ++++++++++---------- engines/dreamweb/stubs.h | 42 ++++++++----------------------------- 5 files changed, 83 insertions(+), 69 deletions(-) (limited to 'engines/dreamweb') diff --git a/engines/dreamweb/backdrop.cpp b/engines/dreamweb/backdrop.cpp index 3e005fdec9..15a226a5ac 100644 --- a/engines/dreamweb/backdrop.cpp +++ b/engines/dreamweb/backdrop.cpp @@ -274,7 +274,7 @@ void DreamGenContext::showAllFree() { } } -void DreamGenContext::drawFlags() { +void DreamBase::drawFlags() { uint8 *mapFlags = getSegment(data.word(kBuffers)).ptr(kMapflags, 0); const uint8 *mapData = getSegment(data.word(kMapdata)).ptr(kMap + data.byte(kMapy) * kMapwidth + data.byte(kMapx), 0); const uint8 *backdropFlags = getSegment(data.word(kBackdrop)).ptr(kFlags, 0); diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index 5f2d3d5e70..2e3c530853 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -57,6 +57,35 @@ public: DreamBase(DreamWeb::DreamWebEngine *en); public: + // from backdrop.cpp + void drawFlags(); + + // from keypad.cpp + void getUnderMenu(); + void putUnderMenu(); + void singleKey(uint8 key, uint16 x, uint16 y); + void loadKeypad(); + void showKeypad(); + bool isItRight(uint8 digit0, uint8 digit1, uint8 digit2, uint8 digit3); + void addToPressList(); + void buttonOne(); + void buttonTwo(); + void buttonThree(); + void buttonFour(); + void buttonFive(); + void buttonSix(); + void buttonSeven(); + void buttonEight(); + void buttonNine(); + void buttonNought(); + void buttonEnter(); + void buttonPress(uint8 buttonId); + void showOuterPad(); + void dumpKeypad(); + void dumpSymbol(); + void dumpSymBox(); + void quitSymbol(); + // from monitor.cpp void input(); byte makeCaps(byte c); @@ -180,6 +209,15 @@ public: void loadRoomData(const Room &room, bool skipDat); void useTempCharset(); void useCharset1(); + void printMessage(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered); + void printMessage2(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered, uint8 count); + bool isItDescribed(const ObjPos *objPos); + void zoomIcon(); + void roomName(); + void showIcon(); + void eraseOldObs(); + void commandOnly(uint8 command); + void blank(); // from use.cpp void placeFreeObject(uint8 index); diff --git a/engines/dreamweb/keypad.cpp b/engines/dreamweb/keypad.cpp index 09bdcb837b..795f5b053e 100644 --- a/engines/dreamweb/keypad.cpp +++ b/engines/dreamweb/keypad.cpp @@ -24,15 +24,15 @@ namespace DreamGen { -void DreamGenContext::getUnderMenu() { +void DreamBase::getUnderMenu() { multiGet(getSegment(data.word(kBuffers)).ptr(kUndertimedtext, 0), kMenux, kMenuy, 48, 48); } -void DreamGenContext::putUnderMenu() { +void DreamBase::putUnderMenu() { multiPut(getSegment(data.word(kBuffers)).ptr(kUndertimedtext, 0), kMenux, kMenuy, 48, 48); } -void DreamGenContext::singleKey(uint8 key, uint16 x, uint16 y) { +void DreamBase::singleKey(uint8 key, uint16 x, uint16 y) { if (key == data.byte(kGraphicpress)) { key += 11; if (data.byte(kPresscount) < 8) @@ -42,11 +42,11 @@ void DreamGenContext::singleKey(uint8 key, uint16 x, uint16 y) { showFrame(tempGraphics(), x, y, key, 0); } -void DreamGenContext::loadKeypad() { +void DreamBase::loadKeypad() { loadIntoTemp("DREAMWEB.G02"); } -void DreamGenContext::showKeypad() { +void DreamBase::showKeypad() { singleKey(22, kKeypadx+9, kKeypady+5); singleKey(23, kKeypadx+31, kKeypady+5); singleKey(24, kKeypadx+53, kKeypady+5); @@ -75,13 +75,13 @@ void DreamGenContext::showKeypad() { } } -bool DreamGenContext::isItRight(uint8 digit0, uint8 digit1, uint8 digit2, uint8 digit3) { +bool DreamBase::isItRight(uint8 digit0, uint8 digit1, uint8 digit2, uint8 digit3) { return digit0 == data.byte(kPresslist+0) && digit1 == data.byte(kPresslist+1) && digit2 == data.byte(kPresslist+2) && digit3 == data.byte(kPresslist+3); } -void DreamGenContext::addToPressList() { +void DreamBase::addToPressList() { if (data.word(kPresspointer) == 5) return; uint8 pressed = data.byte(kPressed); @@ -164,51 +164,51 @@ void DreamGenContext::enterCode(uint8 digit0, uint8 digit1, uint8 digit2, uint8 workToScreenM(); } -void DreamGenContext::buttonOne() { +void DreamBase::buttonOne() { buttonPress(1); } -void DreamGenContext::buttonTwo() { +void DreamBase::buttonTwo() { buttonPress(2); } -void DreamGenContext::buttonThree() { +void DreamBase::buttonThree() { buttonPress(3); } -void DreamGenContext::buttonFour() { +void DreamBase::buttonFour() { buttonPress(4); } -void DreamGenContext::buttonFive() { +void DreamBase::buttonFive() { buttonPress(5); } -void DreamGenContext::buttonSix() { +void DreamBase::buttonSix() { buttonPress(6); } -void DreamGenContext::buttonSeven() { +void DreamBase::buttonSeven() { buttonPress(7); } -void DreamGenContext::buttonEight() { +void DreamBase::buttonEight() { buttonPress(8); } -void DreamGenContext::buttonNine() { +void DreamBase::buttonNine() { buttonPress(9); } -void DreamGenContext::buttonNought() { +void DreamBase::buttonNought() { buttonPress(10); } -void DreamGenContext::buttonEnter() { +void DreamBase::buttonEnter() { buttonPress(11); } -void DreamGenContext::buttonPress(uint8 buttonId) { +void DreamBase::buttonPress(uint8 buttonId) { uint8 commandType = 100 + buttonId; if (data.byte(kCommandtype) != commandType) { data.byte(kCommandtype) = commandType; @@ -223,28 +223,28 @@ void DreamGenContext::buttonPress(uint8 buttonId) { } } -void DreamGenContext::showOuterPad() { +void DreamBase::showOuterPad() { showFrame(tempGraphics(), kKeypadx-3, kKeypady-4, 1, 0); showFrame(tempGraphics(), kKeypadx+74, kKeypady+76, 37, 0); } -void DreamGenContext::dumpKeypad() { +void DreamBase::dumpKeypad() { multiDump(kKeypadx - 3, kKeypady - 4, 120, 90); } -void DreamGenContext::dumpSymbol() { +void DreamBase::dumpSymbol() { data.byte(kNewtextline) = 0; multiDump(kSymbolx, kSymboly + 20, 104, 60); } -void DreamGenContext::dumpSymBox() { +void DreamBase::dumpSymBox() { if (data.word(kDumpx) != 0xFFFF) { multiDump(data.word(kDumpx), data.word(kDumpy), 30, 77); data.word(kDumpx) = 0xFFFF; } } -void DreamGenContext::quitSymbol() { +void DreamBase::quitSymbol() { if (data.byte(kSymboltopx) != 24 || data.byte(kSymbolbotx) != 24) { blank(); return; diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 1c66ac7681..014e3143d9 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -1015,7 +1015,7 @@ void DreamGenContext::DOSReturn() { void DreamGenContext::set16ColPalette() { } -void DreamGenContext::eraseOldObs() { +void DreamBase::eraseOldObs() { if (data.byte(kNewobs) == 0) return; @@ -1200,10 +1200,10 @@ void DreamBase::delTextLine() { } void DreamGenContext::commandOnly() { - commandOnly(al); + commandOnly(al); } -void DreamGenContext::commandOnly(uint8 command) { +void DreamBase::commandOnly(uint8 command) { delTextLine(); uint16 index = command * 2; uint16 offset = kTextstart + getSegment(data.word(kCommandtext)).word(index); @@ -1749,7 +1749,7 @@ void DreamGenContext::printMessage() { printMessage(di, bx, al, dl, (bool)(dl & 1)); } -void DreamGenContext::printMessage(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered) { +void DreamBase::printMessage(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered) { uint16 offset = kTextstart + getSegment(data.word(kCommandtext)).word(index * 2); const uint8 *string = getSegment(data.word(kCommandtext)).ptr(offset, 0); printDirect(string, x, y, maxWidth, centered); @@ -1759,7 +1759,7 @@ void DreamGenContext::printMessage2() { printMessage2(di, bx, al, dl, (bool)(dl & 1), ah); } -void DreamGenContext::printMessage2(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered, uint8 count) { +void DreamBase::printMessage2(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered, uint8 count) { uint16 offset = kTextstart + getSegment(data.word(kCommandtext)).word(index * 2); const uint8 *string = getSegment(data.word(kCommandtext)).ptr(offset, 0); while (count--) { @@ -1768,7 +1768,7 @@ void DreamGenContext::printMessage2(uint16 x, uint16 y, uint8 index, uint8 maxWi printDirect(string, x, y, maxWidth, centered); } -bool objectMatches(void *object, const char *id) { +static bool objectMatches(void *object, const char *id) { const char *objId = (const char *)(((const uint8 *)object) + 12); // whether it is a DynObject or a SetObject for (size_t i = 0; i < 4; ++i) { if (id[i] != objId[i] + 'A') @@ -1826,7 +1826,7 @@ uint16 DreamGenContext::findExObject(const char *id) { return kNumexobjects; } -bool DreamGenContext::isItDescribed(const ObjPos *pos) { +bool DreamBase::isItDescribed(const ObjPos *pos) { uint16 offset = getSegment(data.word(kSetdesc)).word(kSettextdat + pos->index * 2); uint8 result = getSegment(data.word(kSetdesc)).byte(kSettext + offset); return result != 0; @@ -1840,7 +1840,7 @@ bool DreamGenContext::isCD() { return (data.byte(kSpeechloaded) == 1); } -void DreamGenContext::showIcon() { +void DreamBase::showIcon() { if (data.byte(kReallocation) < 50) { showPanel(); showMan(); @@ -2188,7 +2188,7 @@ void DreamGenContext::watchCount() { } } -void DreamGenContext::roomName() { +void DreamBase::roomName() { printMessage(88, 18, 53, 240, false); uint16 textIndex = data.byte(kRoomnum); if (textIndex >= 32) @@ -2202,7 +2202,7 @@ void DreamGenContext::roomName() { useCharset1(); } -void DreamGenContext::zoomIcon() { +void DreamBase::zoomIcon() { if (data.byte(kZoomon) == 0) return; showFrame(engine->icons1(), kZoomx, kZoomy-1, 8, 0); @@ -3362,7 +3362,7 @@ void DreamGenContext::selectSlot2() { selectSlot(); } -void DreamGenContext::blank() { +void DreamBase::blank() { if (data.byte(kCommandtype) != 199) { data.byte(kCommandtype) = 199; commandOnly(0); diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index b7e477804c..c028c6851b 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -59,9 +59,13 @@ return DreamBase::printDirect(string, x, y, maxWidth, centered); } void printMessage(); - void printMessage(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered); + void printMessage(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered) { + DreamBase::printMessage(x, y, index, maxWidth, centered); + } void printMessage2(); - void printMessage2(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered, uint8 count); + void printMessage2(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered, uint8 count) { + DreamBase::printMessage2(x, y, index, maxWidth, centered, count); + } void useTimedText(); void dumpTimedText(); void setupTimedTemp(uint8 textIndex, uint8 voiceIndex, uint8 x, uint8 y, uint16 countToTimed, uint16 timeCount); @@ -80,7 +84,6 @@ } void printASprite(const Sprite *sprite); void width160(); - void eraseOldObs(); void clearSprites(); Sprite *makeSprite(uint8 x, uint8 y, uint16 updateCallback, uint16 frameData, uint16 somethingInDi); void spriteUpdate(); @@ -114,7 +117,9 @@ void zoom(); void showRain(); void commandOnly(); - void commandOnly(uint8 command); + void commandOnly(uint8 command) { + DreamBase::commandOnly(command); + } void doBlocks(); void checkIfPerson(); bool checkIfPerson(uint8 x, uint8 y); @@ -184,7 +189,6 @@ void obName(uint8 command, uint8 commandType); void animPointer(); void checkCoords(const RectWithCallback *rectWithCallbacks); - void drawFlags(); void addToPeopleList(); void addToPeopleList(ReelRoutine *routine); void getExPos(); @@ -192,7 +196,6 @@ void compare(); bool compare(uint8 index, uint8 flag, const char id[4]); bool pixelCheckSet(const ObjPos *pos, uint8 x, uint8 y); - bool isItDescribed(const ObjPos *objPos); void checkIfSet(); bool checkIfSet(uint8 x, uint8 y); void checkIfPathIsOn(); @@ -216,7 +219,6 @@ void hangOnW(uint16 frameCount); void hangOnP(); void hangOnP(uint16 count); - void showIcon(); uint8 findNextColon(const uint8 **string) { return DreamBase::findNextColon(string); } @@ -232,15 +234,11 @@ void convIcons(); void examineOb(bool examineAgain = true); void dumpWatch(); - void roomName(); void transferText(); void initRain(); Rain *splitIntoLines(uint8 x, uint8 y, Rain *rain); void watchCount(); - void zoomIcon(); void loadRoom(); - void getUnderMenu(); - void putUnderMenu(); void textForMonk(); void textForMonkHelper(uint8 textIndex, uint8 voiceIndex, uint8 x, uint8 y, uint16 countToTimed, uint16 timeCount); void textForEnd(); @@ -422,26 +420,9 @@ void helicopter(ReelRoutine &routine); void singleKey(uint8 key, uint16 x, uint16 y); void loadSaveBox(); - void loadKeypad(); - void showKeypad(); - void showOuterPad(); uint8 nextSymbol(uint8 symbol); void showSymbol(); void examIcon(); - void buttonOne(); - void buttonTwo(); - void buttonThree(); - void buttonFour(); - void buttonFive(); - void buttonSix(); - void buttonSeven(); - void buttonEight(); - void buttonNine(); - void buttonNought(); - void buttonEnter(); - void buttonPress(uint8 buttonId); - void addToPressList(); - bool isItRight(uint8 digit0, uint8 digit1, uint8 digit2, uint8 digit3); void enterCode(uint8 digit0, uint8 digit1, uint8 digit2, uint8 digit3); unsigned int scanForNames(); void doLoad(int slot); @@ -481,7 +462,6 @@ void redrawMainScrn(); void selectSlot(); void selectSlot2(); - void blank(); void allPointer(); void openYourNeighbour(); void openRyan(); @@ -525,9 +505,6 @@ void redes(); void isSetObOnMap(); bool isSetObOnMap(uint8 index); - void dumpKeypad(); - void dumpSymbol(); - void dumpSymBox(); void dumpZoom(); void selectLocation(); void showGroup(); @@ -560,7 +537,6 @@ void hangOnPQ(); void showGun(); void endGame(); - void quitSymbol(); void diaryKeyP(); void diaryKeyN(); void checkInput(); -- cgit v1.2.3