From 42068065b57993c865823ff56e81bd7a87aa0278 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sat, 24 Dec 2011 13:55:56 +0100 Subject: DREAMWEB: Move more functions to DreamBase --- engines/dreamweb/dreambase.h | 14 +++++++++ engines/dreamweb/monitor.cpp | 2 +- engines/dreamweb/object.cpp | 14 ++------- engines/dreamweb/stubs.cpp | 71 ++++++-------------------------------------- engines/dreamweb/stubs.h | 36 ---------------------- engines/dreamweb/use.cpp | 39 ++++++++++++++++++------ 6 files changed, 57 insertions(+), 119 deletions(-) diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index 720fcb3116..750cffdeac 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -169,6 +169,7 @@ public: void loadPersonal(); void loadNews(); void loadCart(); + void showKeys(); // from newplace.cpp void getUnderCentre(); @@ -190,6 +191,9 @@ public: void deleteExText(uint8 textNum); void purgeALocation(uint8 index); const uint8 *getObTextStart(); + void wornError(); + void makeWorn(DynObject *object); + void dropObject(); // from pathfind.cpp void turnPathOn(uint8 param); @@ -527,6 +531,12 @@ public: void showDiaryPage(); void showDiaryKeys(); void dumpDiaryKeys(); + void useMenu(); + void incRyanPage(); + void edensFlatReminders(); + void dropError(); + void cantDrop(); + void entryAnims(); // from use.cpp void placeFreeObject(uint8 index); @@ -610,6 +620,10 @@ public: void useAltar(); void notHeldError(); void useCashCard(); + void useButtonA(); + void wearWatch(); + void wearShades(); + void useTrainer(); // from vgafades.cpp void clearStartPal(); diff --git a/engines/dreamweb/monitor.cpp b/engines/dreamweb/monitor.cpp index 9a1076a92f..3ee68e897c 100644 --- a/engines/dreamweb/monitor.cpp +++ b/engines/dreamweb/monitor.cpp @@ -426,7 +426,7 @@ void DreamBase::loadCart() { data.word(kTextfile3) = standardLoad("DREAMWEB.T24"); // monitor file 24 } -void DreamGenContext::showKeys() { +void DreamBase::showKeys() { randomAccess(10); scrollMonitor(); monMessage(18); diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index 04081e2f0e..1245187a92 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -66,7 +66,7 @@ bool DreamBase::isItWorn(const DynObject *object) { return (object->id[0] == 'W'-'A') && (object->id[1] == 'E'-'A'); } -void DreamGenContext::wornError() { +void DreamBase::wornError() { data.byte(kCommandtype) = 255; delPointer(); printMessage(76, 21, 57, 240, false); @@ -79,7 +79,7 @@ void DreamGenContext::wornError() { workToScreenM(); } -void DreamGenContext::makeWorn(DynObject *object) { +void DreamBase::makeWorn(DynObject *object) { object->id[0] = 'W'-'A'; object->id[1] = 'E'-'A'; } @@ -461,10 +461,6 @@ void DreamGenContext::setPickup() { workToScreenM(); } -void DreamGenContext::deleteExFrame() { - deleteExFrame(al); -} - void DreamBase::deleteExFrame(uint8 frameNum) { Frame *frame = (Frame *)getSegment(data.word(kExtras)).ptr(kExframedata + sizeof(Frame)*frameNum, sizeof(Frame)); @@ -488,10 +484,6 @@ void DreamBase::deleteExFrame(uint8 frameNum) { } } -void DreamGenContext::deleteExText() { - deleteExText(al); -} - void DreamBase::deleteExText(uint8 textNum) { uint16 offset = getSegment(data.word(kExtras)).word(kExtextdat + 2*textNum); @@ -704,7 +696,7 @@ const uint8 *DreamBase::getObTextStart() { } } -void DreamGenContext::dropObject() { +void DreamBase::dropObject() { if (data.byte(kCommandtype) != 223) { data.byte(kCommandtype) = 223; if (!data.byte(kPickup)) { diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 9a7b66ac72..0f5b6541d7 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -1708,18 +1708,6 @@ uint16 DreamBase::findSetObject(const char *id) { return 128; } -void DreamGenContext::findExObject() { - char id[5]; - id[0] = al; - id[1] = ah; - id[2] = cl; - id[3] = ch; - id[4] = '\0'; - al = findExObject(id); - es = data.word(kExtras); - bx = kExdata + al * 16; -} - uint16 DreamBase::findExObject(const char *id) { for (uint16 index = 0; index < kNumexobjects; index++) { if (objectMatches(getExAd(index), id)) @@ -1729,16 +1717,6 @@ uint16 DreamBase::findExObject(const char *id) { return kNumexobjects; } -void DreamGenContext::isRyanHolding() { - char id[5]; - id[0] = al; - id[1] = ah; - id[2] = cl; - id[3] = ch; - id[4] = '\0'; - flags._z = !isRyanHolding(id); -} - bool DreamBase::isRyanHolding(const char *id) { for (uint16 index = 0; index < kNumexobjects; index++) { DynObject *object = getExAd(index); @@ -1859,13 +1837,6 @@ void DreamBase::hangOnP(uint16 count) { data.byte(kPointermode) = 0; } -void DreamGenContext::findNextColon() { - const uint8 *initialString = es.ptr(si, 0); - const uint8 *string = initialString; - al = findNextColon(&string); - si += (string - initialString); -} - uint8 DreamBase::findNextColon(const uint8 **string) { uint8 c; do { @@ -2572,7 +2543,7 @@ void DreamBase::dumpMenu() { multiDump(kMenux, kMenuy, 48, 48); } -void DreamGenContext::useMenu() { +void DreamBase::useMenu() { getRidOfReels(); loadMenu(); createPanel(); @@ -3296,7 +3267,7 @@ void DreamBase::diaryKeyN() { data.byte(kDiarypage) = 0; } -void DreamGenContext::dropError() { +void DreamBase::dropError() { data.byte(kCommandtype) = 255; delPointer(); printMessage(76, 21, 56, 240, 240 & 1); @@ -3309,7 +3280,7 @@ void DreamGenContext::dropError() { workToScreenM(); } -void DreamGenContext::cantDrop() { +void DreamBase::cantDrop() { data.byte(kCommandtype) = 255; delPointer(); printMessage(76, 21, 24, 240, 240 & 1); @@ -3344,26 +3315,6 @@ void DreamBase::getBack1() { } } -void DreamGenContext::useButtonA() { - if (!isSetObOnMap(95)) { - showFirstUse(); - turnAnyPathOn(0, data.byte(kRoomnum) - 1); - removeSetObject(9); - placeSetObject(95); - data.word(kWatchingtime) = 15 * 2; - data.word(kReeltowatch) = 71; - data.word(kEndwatchreel) = 85; - data.byte(kWatchspeed) = 1; - data.byte(kSpeedcount) = 1; - data.byte(kGetback) = 1; - data.byte(kProgresspoints)++; - } else { - // Done this bit - showSecondUse(); - putBackObStuff(); - } -} - void DreamBase::autoAppear() { if (data.byte(kLocation) == 32) { // In alley @@ -3417,10 +3368,6 @@ void DreamBase::quitKey() { data.byte(kGetback) = 1; } -void DreamGenContext::setupTimedUse() { - DreamBase::setupTimedUse(al, cx, dx, bl, bh); -} - void DreamBase::setupTimedUse(uint16 textIndex, uint16 countToTimed, uint16 timeCount, byte x, byte y) { if (data.word(kTimecount) != 0) return; // can't setup @@ -3463,7 +3410,7 @@ void DreamBase::entryTexts() { } } -void DreamGenContext::entryAnims() { +void DreamBase::entryAnims() { data.word(kReeltowatch) = 0xFFFF; data.byte(kWatchmode) = (byte)-1; @@ -3731,7 +3678,7 @@ void DreamBase::showDiaryKeys() { showDiaryPage(); } -void DreamGenContext::edensFlatReminders() { +void DreamBase::edensFlatReminders() { if (data.byte(kReallocation) != 24 || data.byte(kMapx) != 44) return; // not in Eden's lift @@ -3740,18 +3687,18 @@ void DreamGenContext::edensFlatReminders() { uint16 exObjextIndex = findExObject("CSHR"); if (!isRyanHolding("DKEY") || exObjextIndex == kNumexobjects) { - DreamBase::setupTimedUse(50, 48, 8, 54, 70); // forgot something + setupTimedUse(50, 48, 8, 54, 70); // forgot something return; } DynObject *object = getExAd(exObjextIndex); if (object->mapad[0] != 4) { - DreamBase::setupTimedUse(50, 48, 8, 54, 70); // forgot something + setupTimedUse(50, 48, 8, 54, 70); // forgot something return; } else if (object->mapad[1] != 255) { if (!compare(object->mapad[1], object->mapad[0], "PURS")) { - DreamBase::setupTimedUse(50, 48, 8, 54, 70); // forgot something + setupTimedUse(50, 48, 8, 54, 70); // forgot something return; } } @@ -3759,7 +3706,7 @@ void DreamGenContext::edensFlatReminders() { data.byte(kProgresspoints)++; // got card } -void DreamGenContext::incRyanPage() { +void DreamBase::incRyanPage() { if (data.byte(kCommandtype) != 222) { data.byte(kCommandtype) = 222; commandOnly(31); diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index da14962a27..b24185b82d 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -103,8 +103,6 @@ bool isItWorn(const DynObject *object) { return DreamBase::isItWorn(object); } - void wornError(); - void makeWorn(DynObject *object); void obToInv(); void obToInv(uint8 index, uint8 flag, uint16 x, uint16 y) { DreamBase::obToInv(index, flag, x, y); @@ -114,11 +112,6 @@ void hangOn(uint16 frameCount) { DreamBase::hangOn(frameCount); } - uint8 findNextColon(const uint8 **string) { - return DreamBase::findNextColon(string); - } - void findNextColon(); - const uint8 *getObTextStartCPP(); void showCity(); uint16 getPersFrame(uint8 index); void convIcons(); @@ -127,7 +120,6 @@ void transferText(); void watchCount(); void readSetData(); - void useMenu(); void useMon(); void makeCaps(); byte makeCaps(byte c) { @@ -156,8 +148,6 @@ void useElevator1(); void useKey(); void useObject(); - void wearWatch(); - void wearShades(); void singleKey(uint8 key, uint16 x, uint16 y); uint8 nextSymbol(uint8 symbol); void showSymbol(); @@ -177,7 +167,6 @@ void afterIntroRoom(); void gettingShot(); void allPointer(); - void useTrainer(); void chewy(); void delEverything(); void errorMessage1(); @@ -201,28 +190,15 @@ void hangOnPQ(); void showGun(); void endGame(); - void dropError(); - void cantDrop(); void newPlace(); void monkSpeaking(); void rollEndCredits2(); - void useButtonA(); - void setupTimedUse(); - void entryAnims(); void triggerMessage(uint16 index); void processTrigger(); void updateSymbolTop(); void updateSymbolBot(); void runEndSeq(); bool execCommand(); - void findExObject(); - uint16 findExObject(const char *id) { - return DreamBase::findExObject(id); - } - void isRyanHolding(); - bool isRyanHolding(const char *id) { - return DreamBase::isRyanHolding(id); - } void getOpenedSize(); byte getOpenedSizeCPP(); void openOb(); @@ -232,26 +208,14 @@ void findInvPos(); uint16 findInvPosCPP(); void setPickup(); - void showKeys(); void getKeyAndLogo(); void deleteExObject(); void deleteExObject(uint8 index) { DreamBase::deleteExObject(index); } - void deleteExFrame(); - void deleteExFrame(uint8 frameNum) { - DreamBase::deleteExFrame(frameNum); - } - void deleteExText(); - void deleteExText(uint8 textNum) { - DreamBase::deleteExText(textNum); - } void signOn(); void lookAtPlace(); void inToInv(); void outOfInv(); - void edensFlatReminders(); - void incRyanPage(); - void dropObject(); #endif diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp index bbcf028b78..47c9ae62b8 100644 --- a/engines/dreamweb/use.cpp +++ b/engines/dreamweb/use.cpp @@ -46,7 +46,7 @@ void DreamGenContext::useRoutine() { { &DreamBase::useElevator5, "ELVF" }, { &DreamBase::useChurchGate, "CGAT" }, { &DreamGenContext::useStereo, "REMO" }, - { &DreamGenContext::useButtonA, "BUTA" }, + { &DreamBase::useButtonA, "BUTA" }, { &DreamBase::useWinch, "CBOX" }, { &DreamBase::useLighter, "LITE" }, { &DreamBase::usePlate, "PLAT" }, @@ -61,7 +61,7 @@ void DreamGenContext::useRoutine() { { &DreamBase::useCardReader2, "CRBB" }, { &DreamBase::useCardReader3, "CRCC" }, { &DreamBase::sitDownInBar, "SEAT" }, - { &DreamGenContext::useMenu, "MENU" }, + { &DreamBase::useMenu, "MENU" }, { &DreamBase::useCooker, "COOK" }, { &DreamBase::callHotelLift, "ELCA" }, { &DreamBase::callEdensLift, "EDCA" }, @@ -75,9 +75,9 @@ void DreamGenContext::useRoutine() { { &DreamBase::openYourNeighbour, "ENTC" }, { &DreamBase::openEden, "ENTD" }, { &DreamBase::openSarters, "ENTH" }, - { &DreamGenContext::wearWatch, "WWAT" }, + { &DreamBase::wearWatch, "WWAT" }, { &DreamBase::usePoolReader, "POOL" }, - { &DreamGenContext::wearShades, "WSHD" }, + { &DreamBase::wearShades, "WSHD" }, { &DreamBase::grafittiDoor, "GRAF" }, { &DreamBase::trapDoor, "TRAP" }, { &DreamBase::edensCDPlayer, "CDPE" }, @@ -97,8 +97,8 @@ void DreamGenContext::useRoutine() { { &DreamBase::useBalcony, "BALC" }, { &DreamBase::useWindow, "WIND" }, { &DreamBase::viewFolder, "PAPR" }, - { &DreamGenContext::useTrainer, "UWTA" }, - { &DreamGenContext::useTrainer, "UWTB" }, + { &DreamBase::useTrainer, "UWTA" }, + { &DreamBase::useTrainer, "UWTB" }, { &DreamGenContext::enterSymbol, "STAT" }, { &DreamBase::openTomb, "TLID" }, { &DreamBase::useSlab, "SLAB" }, @@ -355,7 +355,7 @@ void DreamBase::useRailing() { data.byte(kMandead) = 4; } -void DreamGenContext::wearWatch() { +void DreamBase::wearWatch() { if (data.byte(kWatchon) == 1) { // Already wearing watch showSecondUse(); @@ -369,7 +369,7 @@ void DreamGenContext::wearWatch() { } } -void DreamGenContext::wearShades() { +void DreamBase::wearShades() { if (data.byte(kShadeson) == 1) { // Already wearing shades showSecondUse(); @@ -1027,7 +1027,7 @@ void DreamBase::useCart() { data.byte(kGetback) = 1; } -void DreamGenContext::useTrainer() { +void DreamBase::useTrainer() { uint8 dummy; DynObject *object = (DynObject *)getAnyAd(&dummy, &dummy); if (object->mapad[0] != 4) { @@ -1684,4 +1684,25 @@ void DreamBase::showPuzText(uint16 command, uint16 count) { hangOnP(count); } +void DreamBase::useButtonA() { + if (!isSetObOnMap(95)) { + showFirstUse(); + turnAnyPathOn(0, data.byte(kRoomnum) - 1); + removeSetObject(9); + placeSetObject(95); + data.word(kWatchingtime) = 15 * 2; + data.word(kReeltowatch) = 71; + data.word(kEndwatchreel) = 85; + data.byte(kWatchspeed) = 1; + data.byte(kSpeedcount) = 1; + data.byte(kGetback) = 1; + data.byte(kProgresspoints)++; + } else { + // Done this bit + showSecondUse(); + putBackObStuff(); + } +} + + } // End of namespace DreamGen -- cgit v1.2.3