From 3802b21183b148f1c8d43cc8d2e550afed6e9e6a Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 25 Dec 2011 15:07:56 +0200 Subject: DREAMWEB: Move some functions to DreamBase --- engines/dreamweb/dreambase.h | 5 +++++ engines/dreamweb/newplace.cpp | 7 ++++--- engines/dreamweb/structs.h | 2 +- engines/dreamweb/stubs.h | 7 +------ engines/dreamweb/use.cpp | 41 ++++++++++++++++++++++------------------- 5 files changed, 33 insertions(+), 29 deletions(-) diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index 2a61331290..9e45e046f4 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -178,6 +178,9 @@ public: uint8 getLocation(uint8 index); void setLocation(uint8 index); void resetLocation(uint8 index); + void readCityPic(); + void readDestIcon(); + void showCity(); // from object.cpp void obIcons(); @@ -636,6 +639,8 @@ public: void wearWatch(); void wearShades(); void useTrainer(); + void useStereo(); + void chewy(); // from vgafades.cpp void clearStartPal(); diff --git a/engines/dreamweb/newplace.cpp b/engines/dreamweb/newplace.cpp index f1743f0e6d..69e452865e 100644 --- a/engines/dreamweb/newplace.cpp +++ b/engines/dreamweb/newplace.cpp @@ -34,6 +34,7 @@ void DreamGenContext::newPlace() { } } +// TODO: Move to DreamBase once locationPic is moved void DreamGenContext::selectLocation() { data.byte(kInmaparea) = 0; clearBeforeLoad(); @@ -95,7 +96,7 @@ void DreamGenContext::selectLocation() { deallocateMem(data.word(kTraveltext)); } -void DreamGenContext::showCity() { +void DreamBase::showCity() { clearWork(); showFrame(tempGraphics(), 57, 32, 0, 0); showFrame(tempGraphics(), 120+57, 32, 1, 0); @@ -259,13 +260,13 @@ void DreamBase::resetLocation(uint8 index) { data.byte(kRoomscango + index) = 0; } -void DreamGenContext::readDestIcon() { +void DreamBase::readDestIcon() { loadIntoTemp("DREAMWEB.G05"); loadIntoTemp2("DREAMWEB.G06"); loadIntoTemp3("DREAMWEB.G08"); } -void DreamGenContext::readCityPic() { +void DreamBase::readCityPic() { loadIntoTemp("DREAMWEB.G04"); } diff --git a/engines/dreamweb/structs.h b/engines/dreamweb/structs.h index 5d93d1d99f..d64bcab5d0 100644 --- a/engines/dreamweb/structs.h +++ b/engines/dreamweb/structs.h @@ -123,7 +123,7 @@ struct DynObject { uint8 slotSize; // the size of an object's slots uint8 slotCount; // the number of slots of an object uint8 objectSize; // the size of an object - uint8 b10; + uint8 turnedOn; uint8 initialLocation; uint8 id[4]; }; diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 547714e006..0c764a4495 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -39,8 +39,6 @@ } void quickQuit(); void readOneBlock(); - void readCityPic(); - void readDestIcon(); void seeCommandTail(); void quickQuit2(); void printDirect(); @@ -95,7 +93,6 @@ void hangOn(uint16 frameCount) { DreamBase::hangOn(frameCount); } - void showCity(); void examineOb(bool examineAgain = true); void dumpWatch(); void transferText(); @@ -148,7 +145,6 @@ void afterIntroRoom(); void gettingShot(); void allPointer(); - void chewy(); void delEverything(); void errorMessage1(); void errorMessage2(); @@ -156,7 +152,6 @@ void nextDest(); void lastDest(); void destSelect(); - void selectLocation(); void loadSpeech(); bool loadSpeech(byte type1, int idx1, byte type2, int idx2) { return DreamBase::loadSpeech(type1, idx1, type2, idx2); @@ -183,7 +178,6 @@ bool checkObjectSizeCPP(); void openOb(); void identifyOb(); - void useStereo(); void selectOb(); void findInvPos(); uint16 findInvPosCPP(); @@ -198,5 +192,6 @@ void inToInv(); void outOfInv(); void selectOpenOb(); + void selectLocation(); #endif diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp index 47c9ae62b8..eeda27780c 100644 --- a/engines/dreamweb/use.cpp +++ b/engines/dreamweb/use.cpp @@ -45,7 +45,7 @@ void DreamGenContext::useRoutine() { { &DreamBase::useElevator4, "ELVE" }, { &DreamBase::useElevator5, "ELVF" }, { &DreamBase::useChurchGate, "CGAT" }, - { &DreamGenContext::useStereo, "REMO" }, + { &DreamBase::useStereo, "REMO" }, { &DreamBase::useButtonA, "BUTA" }, { &DreamBase::useWinch, "CBOX" }, { &DreamBase::useLighter, "LITE" }, @@ -113,7 +113,7 @@ void DreamGenContext::useRoutine() { { &DreamBase::usePlinth, "PLIN" }, { &DreamBase::useLadder, "LADD" }, { &DreamBase::useLadderB, "LADB" }, - { &DreamGenContext::chewy, "GUMA" }, + { &DreamBase::chewy, "GUMA" }, { &DreamBase::wheelSound, "SQEE" }, { &DreamBase::runTap, "TAPP" }, { &DreamBase::playGuitar, "GUIT" }, @@ -242,6 +242,7 @@ void DreamBase::playGuitar() { putBackObStuff(); } +// TODO: Move to DreamBase once selectLocation (in reality, locationPic) is moved void DreamGenContext::useElevator1() { showFirstUse(); selectLocation(); @@ -1040,11 +1041,12 @@ void DreamBase::useTrainer() { } } -void DreamGenContext::chewy() { +void DreamBase::chewy() { + // Chewing a gum showFirstUse(); - // TODO: Use the C++ version of getAnyAd() - getAnyAd(); - es.byte(bx + 2) = 255; + uint8 dummy; + DynObject *object = (DynObject *)getAnyAd(&dummy, &dummy); + object->mapad[0] = 255; data.byte(kGetback) = 1; } @@ -1631,7 +1633,10 @@ void DreamBase::useCashCard() { putBackObStuff(); } -void DreamGenContext::useStereo() { +void DreamBase::useStereo() { + // Handles the stereo in Ryan's apartment (accessible from the remote on + // the couch) + if (data.byte(kLocation) != 0) { showPuzText(4, 400); putBackObStuff(); @@ -1642,20 +1647,18 @@ void DreamGenContext::useStereo() { // No CD inside showPuzText(6, 400); putBackObStuff(); - // TODO: Use the C++ version of getAnyAd() - getAnyAd(); - es.byte(bx + 10) = 255; + uint8 dummy; + DynObject *object = (DynObject *)getAnyAd(&dummy, &dummy); + object->turnedOn = 255; } else { // CD inside - getAnyAd(); - es.byte(bx + 10) ^= 1; - if (es.byte(bx + 10) != 255) { - // Stereo off - showPuzText(7, 400); - } else { - // Stereo on - showPuzText(8, 400); - } + uint8 dummy; + DynObject *object = (DynObject *)getAnyAd(&dummy, &dummy); + object->turnedOn ^= 1; + if (object->turnedOn != 255) + showPuzText(7, 400); // Stereo off + else + showPuzText(8, 400); // Stereo on putBackObStuff(); } -- cgit v1.2.3