aboutsummaryrefslogtreecommitdiff
path: root/engines/dreamweb/use.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/dreamweb/use.cpp')
-rw-r--r--engines/dreamweb/use.cpp1680
1 files changed, 1026 insertions, 654 deletions
diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp
index 0990e5ba5e..e59843539f 100644
--- a/engines/dreamweb/use.cpp
+++ b/engines/dreamweb/use.cpp
@@ -22,10 +22,10 @@
#include "dreamweb/dreamweb.h"
-namespace DreamGen {
+namespace DreamWeb {
-typedef void (DreamGenContext::*UseCallback)(void);
+typedef void (DreamWebEngine::*UseCallback)(void);
// Note: The callback pointer has been placed before the
// ID to keep MSVC happy (otherwise, it throws warnings
@@ -35,111 +35,111 @@ struct UseListEntry {
const char *id;
};
-void DreamGenContext::useRoutine() {
+void DreamWebEngine::useRoutine() {
static const UseListEntry kUseList[] = {
- { &DreamGenContext::useMon, "NETW" },
- { &DreamGenContext::useElevator1, "ELVA" },
- { &DreamGenContext::useElevator2, "ELVB" },
- { &DreamGenContext::useElevator3, "ELVC" },
- { &DreamGenContext::useElevator4, "ELVE" },
- { &DreamGenContext::useElevator5, "ELVF" },
- { &DreamGenContext::useChurchGate, "CGAT" },
- { &DreamGenContext::useStereo, "REMO" },
- { &DreamGenContext::useButtonA, "BUTA" },
- { &DreamGenContext::useWinch, "CBOX" },
- { &DreamGenContext::useLighter, "LITE" },
- { &DreamGenContext::usePlate, "PLAT" },
- { &DreamGenContext::useControl, "LIFT" },
- { &DreamGenContext::useWire, "WIRE" },
- { &DreamGenContext::useHandle, "HNDL" },
- { &DreamGenContext::useHatch, "HACH" },
- { &DreamGenContext::useElvDoor, "DOOR" },
- { &DreamGenContext::useCashCard, "CSHR" },
- { &DreamGenContext::useGun, "GUNA" },
- { &DreamGenContext::useCardReader1, "CRAA" },
- { &DreamGenContext::useCardReader2, "CRBB" },
- { &DreamGenContext::useCardReader3, "CRCC" },
- { &DreamGenContext::sitDownInBar, "SEAT" },
- { &DreamGenContext::useMenu, "MENU" },
- { &DreamGenContext::useCooker, "COOK" },
- { &DreamGenContext::callHotelLift, "ELCA" },
- { &DreamGenContext::callEdensLift, "EDCA" },
- { &DreamGenContext::callEdensDLift, "DDCA" },
- { &DreamGenContext::useAltar, "ALTR" },
- { &DreamGenContext::openHotelDoor, "LOKA" },
- { &DreamGenContext::openHotelDoor2, "LOKB" },
- { &DreamGenContext::openLouis, "ENTA" },
- { &DreamGenContext::openRyan, "ENTB" },
- { &DreamGenContext::openPoolBoss, "ENTE" },
- { &DreamGenContext::openYourNeighbour, "ENTC" },
- { &DreamGenContext::openEden, "ENTD" },
- { &DreamGenContext::openSarters, "ENTH" },
- { &DreamGenContext::wearWatch, "WWAT" },
- { &DreamGenContext::usePoolReader, "POOL" },
- { &DreamGenContext::wearShades, "WSHD" },
- { &DreamGenContext::grafittiDoor, "GRAF" },
- { &DreamGenContext::trapDoor, "TRAP" },
- { &DreamGenContext::edensCDPlayer, "CDPE" },
- { &DreamGenContext::openTVDoor, "DLOK" },
- { &DreamGenContext::useHole, "HOLE" },
- { &DreamGenContext::useDryer, "DRYR" },
- { &DreamGenContext::useChurchHole, "HOLY" },
- { &DreamGenContext::useWall, "WALL" },
- { &DreamGenContext::useDiary, "BOOK" },
- { &DreamGenContext::useAxe, "AXED" },
- { &DreamGenContext::useShield, "SHLD" },
- { &DreamGenContext::useRailing, "BCNY" },
- { &DreamGenContext::useCoveredBox, "LIDC" },
- { &DreamGenContext::useClearBox, "LIDU" },
- { &DreamGenContext::useOpenBox, "LIDO" },
- { &DreamGenContext::usePipe, "PIPE" },
- { &DreamGenContext::useBalcony, "BALC" },
- { &DreamGenContext::useWindow, "WIND" },
- { &DreamGenContext::viewFolder, "PAPR" },
- { &DreamGenContext::useTrainer, "UWTA" },
- { &DreamGenContext::useTrainer, "UWTB" },
- { &DreamGenContext::enterSymbol, "STAT" },
- { &DreamGenContext::openTomb, "TLID" },
- { &DreamGenContext::useSLab, "SLAB" },
- { &DreamGenContext::useCart, "CART" },
- { &DreamGenContext::useFullCart, "FCAR" },
- { &DreamGenContext::sLabDoorA, "SLBA" },
- { &DreamGenContext::sLabDoorB, "SLBB" },
- { &DreamGenContext::sLabDoorC, "SLBC" },
- { &DreamGenContext::sLabDoorD, "SLBD" },
- { &DreamGenContext::sLabDoorE, "SLBE" },
- { &DreamGenContext::sLabDoorF, "SLBF" },
- { &DreamGenContext::usePlinth, "PLIN" },
- { &DreamGenContext::useLadder, "LADD" },
- { &DreamGenContext::useLadderB, "LADB" },
- { &DreamGenContext::chewy, "GUMA" },
- { &DreamGenContext::wheelSound, "SQEE" },
- { &DreamGenContext::runTap, "TAPP" },
- { &DreamGenContext::playGuitar, "GUIT" },
- { &DreamGenContext::hotelControl, "CONT" },
- { &DreamGenContext::hotelBell, "BELL" },
+ { &DreamWebEngine::useMon, "NETW" },
+ { &DreamWebEngine::useElevator1, "ELVA" },
+ { &DreamWebEngine::useElevator2, "ELVB" },
+ { &DreamWebEngine::useElevator3, "ELVC" },
+ { &DreamWebEngine::useElevator4, "ELVE" },
+ { &DreamWebEngine::useElevator5, "ELVF" },
+ { &DreamWebEngine::useChurchGate, "CGAT" },
+ { &DreamWebEngine::useStereo, "REMO" },
+ { &DreamWebEngine::useButtonA, "BUTA" },
+ { &DreamWebEngine::useWinch, "CBOX" },
+ { &DreamWebEngine::useLighter, "LITE" },
+ { &DreamWebEngine::usePlate, "PLAT" },
+ { &DreamWebEngine::useControl, "LIFT" },
+ { &DreamWebEngine::useWire, "WIRE" },
+ { &DreamWebEngine::useHandle, "HNDL" },
+ { &DreamWebEngine::useHatch, "HACH" },
+ { &DreamWebEngine::useElvDoor, "DOOR" },
+ { &DreamWebEngine::useCashCard, "CSHR" },
+ { &DreamWebEngine::useGun, "GUNA" },
+ { &DreamWebEngine::useCardReader1, "CRAA" },
+ { &DreamWebEngine::useCardReader2, "CRBB" },
+ { &DreamWebEngine::useCardReader3, "CRCC" },
+ { &DreamWebEngine::sitDownInBar, "SEAT" },
+ { &DreamWebEngine::useMenu, "MENU" },
+ { &DreamWebEngine::useCooker, "COOK" },
+ { &DreamWebEngine::callHotelLift, "ELCA" },
+ { &DreamWebEngine::callEdensLift, "EDCA" },
+ { &DreamWebEngine::callEdensDLift, "DDCA" },
+ { &DreamWebEngine::useAltar, "ALTR" },
+ { &DreamWebEngine::openHotelDoor, "LOKA" },
+ { &DreamWebEngine::openHotelDoor2, "LOKB" },
+ { &DreamWebEngine::openLouis, "ENTA" },
+ { &DreamWebEngine::openRyan, "ENTB" },
+ { &DreamWebEngine::openPoolBoss, "ENTE" },
+ { &DreamWebEngine::openYourNeighbour, "ENTC" },
+ { &DreamWebEngine::openEden, "ENTD" },
+ { &DreamWebEngine::openSarters, "ENTH" },
+ { &DreamWebEngine::wearWatch, "WWAT" },
+ { &DreamWebEngine::usePoolReader, "POOL" },
+ { &DreamWebEngine::wearShades, "WSHD" },
+ { &DreamWebEngine::grafittiDoor, "GRAF" },
+ { &DreamWebEngine::trapDoor, "TRAP" },
+ { &DreamWebEngine::edensCDPlayer, "CDPE" },
+ { &DreamWebEngine::openTVDoor, "DLOK" },
+ { &DreamWebEngine::useHole, "HOLE" },
+ { &DreamWebEngine::useDryer, "DRYR" },
+ { &DreamWebEngine::useChurchHole, "HOLY" },
+ { &DreamWebEngine::useWall, "WALL" },
+ { &DreamWebEngine::useDiary, "BOOK" },
+ { &DreamWebEngine::useAxe, "AXED" },
+ { &DreamWebEngine::useShield, "SHLD" },
+ { &DreamWebEngine::useRailing, "BCNY" },
+ { &DreamWebEngine::useCoveredBox, "LIDC" },
+ { &DreamWebEngine::useClearBox, "LIDU" },
+ { &DreamWebEngine::useOpenBox, "LIDO" },
+ { &DreamWebEngine::usePipe, "PIPE" },
+ { &DreamWebEngine::useBalcony, "BALC" },
+ { &DreamWebEngine::useWindow, "WIND" },
+ { &DreamWebEngine::viewFolder, "PAPR" },
+ { &DreamWebEngine::useTrainer, "UWTA" },
+ { &DreamWebEngine::useTrainer, "UWTB" },
+ { &DreamWebEngine::enterSymbol, "STAT" },
+ { &DreamWebEngine::openTomb, "TLID" },
+ { &DreamWebEngine::useSlab, "SLAB" },
+ { &DreamWebEngine::useCart, "CART" },
+ { &DreamWebEngine::useFullCart, "FCAR" },
+ { &DreamWebEngine::slabDoorA, "SLBA" },
+ { &DreamWebEngine::slabDoorB, "SLBB" },
+ { &DreamWebEngine::slabDoorC, "SLBC" },
+ { &DreamWebEngine::slabDoorD, "SLBD" },
+ { &DreamWebEngine::slabDoorE, "SLBE" },
+ { &DreamWebEngine::slabDoorF, "SLBF" },
+ { &DreamWebEngine::usePlinth, "PLIN" },
+ { &DreamWebEngine::useLadder, "LADD" },
+ { &DreamWebEngine::useLadderB, "LADB" },
+ { &DreamWebEngine::chewy, "GUMA" },
+ { &DreamWebEngine::wheelSound, "SQEE" },
+ { &DreamWebEngine::runTap, "TAPP" },
+ { &DreamWebEngine::playGuitar, "GUIT" },
+ { &DreamWebEngine::hotelControl, "CONT" },
+ { &DreamWebEngine::hotelBell, "BELL" },
};
- if (data.byte(kReallocation) >= 50) {
- if (data.byte(kPointerpower) == 0)
+ if (_realLocation >= 50) {
+ if (_pointerPower == 0)
return;
- data.byte(kPointerpower) = 0;
+ _pointerPower = 0;
}
- getAnyAd();
- const uint8 *id = es.ptr(bx + 12, 4);
+ uint8 dummy;
+ void *obj = getAnyAd(&dummy, &dummy);
for (size_t i = 0; i < sizeof(kUseList)/sizeof(UseListEntry); ++i) {
const UseListEntry &entry = kUseList[i];
- if (('A' + id[0] == entry.id[0]) && ('A' + id[1] == entry.id[1]) && ('A' + id[2] == entry.id[2]) && ('A' + id[3] == entry.id[3])) {
+ if (objectMatches(obj, entry.id)) {
(this->*entry.callback)();
return;
}
}
delPointer();
- uint8 *obText = getObTextStartCPP();
+ const uint8 *obText = getObTextStart();
if (findNextColon(&obText) != 0) {
if (findNextColon(&obText) != 0) {
if (*obText != 0) {
@@ -160,14 +160,10 @@ void DreamGenContext::useRoutine() {
workToScreenM();
hangOnP(50);
putBackObStuff();
- data.byte(kCommandtype) = 255;
+ _commandType = 255;
}
-void DreamGenContext::useText() {
- useText(es.ptr(si, 0));
-}
-
-void DreamGenContext::useText(const uint8 *string) {
+void DreamWebEngine::useText(const uint8 *string) {
createPanel();
showPanel();
showMan();
@@ -177,16 +173,16 @@ void DreamGenContext::useText(const uint8 *string) {
workToScreenM();
}
-void DreamGenContext::showFirstUse() {
- uint8 *obText = getObTextStartCPP();
+void DreamWebEngine::showFirstUse() {
+ const uint8 *obText = getObTextStart();
findNextColon(&obText);
findNextColon(&obText);
useText(obText);
hangOnP(400);
}
-void DreamGenContext::showSecondUse() {
- uint8 *obText = getObTextStartCPP();
+void DreamWebEngine::showSecondUse() {
+ const uint8 *obText = getObTextStart();
findNextColon(&obText);
findNextColon(&obText);
findNextColon(&obText);
@@ -194,233 +190,204 @@ void DreamGenContext::showSecondUse() {
hangOnP(400);
}
-void DreamGenContext::viewFolder() {
- data.byte(kManisoffscreen) = 1;
- getRidOfAll();
- loadFolder();
- data.byte(kFolderpage) = 0;
- showFolder();
- workToScreenM();
- data.byte(kGetback) = 0;
- do {
- if (quitRequested())
- break;
- delPointer();
- readMouse();
- showPointer();
- vSync();
- dumpPointer();
- dumpTextLine();
- checkFolderCoords();
- } while (data.byte(kGetback) == 0);
- data.byte(kManisoffscreen) = 0;
- getRidOfTemp();
- getRidOfTemp2();
- getRidOfTemp3();
- getRidOfTempCharset();
- restoreAll();
- redrawMainScrn();
- workToScreenM();
-}
-
-void DreamGenContext::edensCDPlayer() {
+void DreamWebEngine::edensCDPlayer() {
showFirstUse();
- data.word(kWatchingtime) = 18 * 2;
- data.word(kReeltowatch) = 25;
- data.word(kEndwatchreel) = 42;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
- data.byte(kGetback) = 1;
+ _vars._watchingTime = 18 * 2;
+ _vars._reelToWatch = 25;
+ _vars._endWatchReel = 42;
+ _vars._watchSpeed = 1;
+ _vars._speedCount = 1;
+ _getBack = 1;
}
-void DreamGenContext::hotelBell() {
+void DreamWebEngine::hotelBell() {
playChannel1(12);
showFirstUse();
putBackObStuff();
}
-void DreamGenContext::playGuitar() {
+void DreamWebEngine::playGuitar() {
playChannel1(14);
showFirstUse();
putBackObStuff();
}
-void DreamGenContext::useElevator1() {
+void DreamWebEngine::useElevator1() {
showFirstUse();
selectLocation();
- data.byte(kGetback) = 1;
+ _getBack = 1;
}
-void DreamGenContext::useElevator2() {
+void DreamWebEngine::useElevator2() {
showFirstUse();
- if (data.byte(kLocation) == 23) // In pool hall
- data.byte(kNewlocation) = 31;
+ if (_vars._location == 23) // In pool hall
+ _newLocation = 31;
else
- data.byte(kNewlocation) = 23;
+ _newLocation = 23;
- data.byte(kCounttoclose) = 20;
- data.byte(kCounttoopen) = 0;
- data.word(kWatchingtime) = 80;
- data.byte(kGetback) = 1;
+ _vars._countToClose = 20;
+ _vars._countToOpen = 0;
+ _vars._watchingTime = 80;
+ _getBack = 1;
}
-void DreamGenContext::useElevator3() {
+void DreamWebEngine::useElevator3() {
showFirstUse();
- data.byte(kCounttoclose) = 20;
- data.byte(kNewlocation) = 34;
- data.word(kReeltowatch) = 46;
- data.word(kEndwatchreel) = 63;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
- data.word(kWatchingtime) = 80;
- data.byte(kGetback) = 1;
+ _vars._countToClose = 20;
+ _newLocation = 34;
+ _vars._reelToWatch = 46;
+ _vars._endWatchReel = 63;
+ _vars._watchSpeed = 1;
+ _vars._speedCount = 1;
+ _vars._watchingTime = 80;
+ _getBack = 1;
}
-void DreamGenContext::useElevator4() {
+void DreamWebEngine::useElevator4() {
showFirstUse();
- data.word(kReeltowatch) = 0;
- data.word(kEndwatchreel) = 11;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
- data.byte(kCounttoclose) = 20;
- data.word(kWatchingtime) = 80;
- data.byte(kGetback) = 1;
- data.byte(kNewlocation) = 24;
+ _vars._reelToWatch = 0;
+ _vars._endWatchReel = 11;
+ _vars._watchSpeed = 1;
+ _vars._speedCount = 1;
+ _vars._countToClose = 20;
+ _vars._watchingTime = 80;
+ _getBack = 1;
+ _newLocation = 24;
}
-void DreamGenContext::useElevator5() {
+void DreamWebEngine::useElevator5() {
placeSetObject(4);
removeSetObject(0);
- data.byte(kNewlocation) = 20;
- data.word(kWatchingtime) = 80;
- data.byte(kLiftflag) = 1;
- data.byte(kCounttoclose) = 8;
- data.byte(kGetback) = 1;
+ _newLocation = 20;
+ _vars._watchingTime = 80;
+ _vars._liftFlag = 1;
+ _vars._countToClose = 8;
+ _getBack = 1;
}
-void DreamGenContext::useHatch() {
+void DreamWebEngine::useHatch() {
showFirstUse();
- data.byte(kNewlocation) = 40;
- data.byte(kGetback) = 1;
+ _newLocation = 40;
+ _getBack = 1;
}
-void DreamGenContext::wheelSound() {
+void DreamWebEngine::wheelSound() {
playChannel1(17);
showFirstUse();
putBackObStuff();
}
-void DreamGenContext::callHotelLift() {
+void DreamWebEngine::callHotelLift() {
playChannel1(12);
showFirstUse();
- data.byte(kCounttoopen) = 8;
- data.byte(kGetback) = 1;
- data.byte(kDestination) = 5;
- data.byte(kFinaldest) = 5;
+ _vars._countToOpen = 8;
+ _getBack = 1;
+ _destination = 5;
+ _finalDest = 5;
autoSetWalk();
turnPathOn(4);
}
-void DreamGenContext::useShield() {
- if (data.byte(kReallocation) != 20 || data.byte(kCombatcount) == 0) {
+void DreamWebEngine::useShield() {
+ if (_realLocation != 20 || _vars._combatCount == 0) {
// Not in Sart room
showFirstUse();
putBackObStuff();
} else {
- data.byte(kLastweapon) = 3;
+ _vars._lastWeapon = 3;
showSecondUse();
- data.byte(kGetback) = 1;
- data.byte(kProgresspoints)++;
+ _getBack = 1;
+ _vars._progressPoints++;
removeObFromInv();
}
}
-void DreamGenContext::useCoveredBox() {
- data.byte(kProgresspoints)++;
+void DreamWebEngine::useCoveredBox() {
+ _vars._progressPoints++;
showFirstUse();
- data.word(kWatchingtime) = 50;
- data.word(kReeltowatch) = 41;
- data.word(kEndwatchreel) = 66;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
- data.byte(kGetback) = 1;
+ _vars._watchingTime = 50;
+ _vars._reelToWatch = 41;
+ _vars._endWatchReel = 66;
+ _vars._watchSpeed = 1;
+ _vars._speedCount = 1;
+ _getBack = 1;
}
-void DreamGenContext::useRailing() {
+void DreamWebEngine::useRailing() {
showFirstUse();
- data.word(kWatchingtime) = 80;
- data.word(kReeltowatch) = 0;
- data.word(kEndwatchreel) = 30;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
- data.byte(kGetback) = 1;
- data.byte(kMandead) = 4;
+ _vars._watchingTime = 80;
+ _vars._reelToWatch = 0;
+ _vars._endWatchReel = 30;
+ _vars._watchSpeed = 1;
+ _vars._speedCount = 1;
+ _getBack = 1;
+ _vars._manDead = 4;
}
-void DreamGenContext::wearWatch() {
- if (data.byte(kWatchon) == 1) {
+void DreamWebEngine::wearWatch() {
+ if (_vars._watchOn == 1) {
// Already wearing watch
showSecondUse();
putBackObStuff();
} else {
showFirstUse();
- data.byte(kWatchon) = 1;
- data.byte(kGetback) = 1;
- getAnyAd();
- makeWorn();
+ _vars._watchOn = 1;
+ _getBack = 1;
+ uint8 dummy;
+ makeWorn((DynObject *)getAnyAd(&dummy, &dummy));
}
}
-void DreamGenContext::wearShades() {
- if (data.byte(kShadeson) == 1) {
+void DreamWebEngine::wearShades() {
+ if (_vars._shadesOn == 1) {
// Already wearing shades
showSecondUse();
putBackObStuff();
} else {
- data.byte(kShadeson) = 1;
+ _vars._shadesOn = 1;
showFirstUse();
- data.byte(kGetback) = 1;
- getAnyAd();
- makeWorn();
+ _getBack = 1;
+ uint8 dummy;
+ makeWorn((DynObject *)getAnyAd(&dummy, &dummy));
}
}
-void DreamGenContext::useChurchHole() {
+void DreamWebEngine::useChurchHole() {
showFirstUse();
- data.byte(kGetback) = 1;
- data.word(kWatchingtime) = 28;
- data.word(kReeltowatch) = 13;
- data.word(kEndwatchreel) = 26;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
+ _getBack = 1;
+ _vars._watchingTime = 28;
+ _vars._reelToWatch = 13;
+ _vars._endWatchReel = 26;
+ _vars._watchSpeed = 1;
+ _vars._speedCount = 1;
}
-void DreamGenContext::sitDownInBar() {
- if (data.byte(kWatchmode) != 0xFF) {
+void DreamWebEngine::sitDownInBar() {
+ if (_vars._watchMode != 0xFF) {
// Sat down
showSecondUse();
putBackObStuff();
} else {
showFirstUse();
- data.word(kWatchingtime) = 50;
- data.word(kReeltowatch) = 55;
- data.word(kEndwatchreel) = 71;
- data.word(kReeltohold) = 73;
- data.word(kEndofholdreel) = 83;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
- data.byte(kGetback) = 1;
+ _vars._watchingTime = 50;
+ _vars._reelToWatch = 55;
+ _vars._endWatchReel = 71;
+ _vars._reelToHold = 73;
+ _vars._endOfHoldReel = 83;
+ _vars._watchSpeed = 1;
+ _vars._speedCount = 1;
+ _getBack = 1;
}
}
-void DreamGenContext::useDryer() {
+void DreamWebEngine::useDryer() {
playChannel1(12);
showFirstUse();
- data.byte(kGetback) = 1;
+ _getBack = 1;
}
-void DreamGenContext::useBalcony() {
+void DreamWebEngine::useBalcony() {
showFirstUse();
turnPathOn(6);
turnPathOff(0);
@@ -429,314 +396,308 @@ void DreamGenContext::useBalcony() {
turnPathOff(3);
turnPathOff(4);
turnPathOff(5);
- data.byte(kProgresspoints)++;
- data.byte(kManspath) = 6;
- data.byte(kDestination) = 6;
- data.byte(kFinaldest) = 6;
+ _vars._progressPoints++;
+ _mansPath = 6;
+ _destination = 6;
+ _finalDest = 6;
findXYFromPath();
switchRyanOff();
- data.byte(kResetmanxy) = 1;
- data.word(kWatchingtime) = 30 * 2;
- data.word(kReeltowatch) = 183;
- data.word(kEndwatchreel) = 212;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
- data.byte(kGetback) = 1;
+ _resetManXY = 1;
+ _vars._watchingTime = 30 * 2;
+ _vars._reelToWatch = 183;
+ _vars._endWatchReel = 212;
+ _vars._watchSpeed = 1;
+ _vars._speedCount = 1;
+ _getBack = 1;
}
-void DreamGenContext::useWindow() {
- if (data.byte(kManspath) != 6) {
+void DreamWebEngine::useWindow() {
+ if (_mansPath != 6) {
// Not on balcony
showSecondUse();
putBackObStuff();
} else {
- data.byte(kProgresspoints)++;
+ _vars._progressPoints++;
showFirstUse();
- data.byte(kNewlocation) = 29;
- data.byte(kGetback) = 1;
+ _newLocation = 29;
+ _getBack = 1;
}
}
-void DreamGenContext::trapDoor() {
- data.byte(kProgresspoints)++;
+void DreamWebEngine::trapDoor() {
+ _vars._progressPoints++;
showFirstUse();
switchRyanOff();
- data.word(kWatchingtime) = 20 * 2;
- data.word(kReeltowatch) = 181;
- data.word(kEndwatchreel) = 197;
- data.byte(kNewlocation) = 26;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
- data.byte(kGetback) = 1;
+ _vars._watchingTime = 20 * 2;
+ _vars._reelToWatch = 181;
+ _vars._endWatchReel = 197;
+ _newLocation = 26;
+ _vars._watchSpeed = 1;
+ _vars._speedCount = 1;
+ _getBack = 1;
}
-void DreamGenContext::callEdensLift() {
+void DreamWebEngine::callEdensLift() {
showFirstUse();
- data.byte(kCounttoopen) = 8;
- data.byte(kGetback) = 1;
+ _vars._countToOpen = 8;
+ _getBack = 1;
turnPathOn(2);
}
-void DreamGenContext::callEdensDLift() {
- if (data.byte(kLiftflag) == 1) {
+void DreamWebEngine::callEdensDLift() {
+ if (_vars._liftFlag == 1) {
// Eden's D here
showSecondUse();
putBackObStuff();
} else {
showFirstUse();
- data.byte(kCounttoopen) = 8;
- data.byte(kGetback) = 1;
+ _vars._countToOpen = 8;
+ _getBack = 1;
turnPathOn(2);
}
}
-void DreamGenContext::openYourNeighbour() {
+void DreamWebEngine::openYourNeighbour() {
enterCode(255, 255, 255, 255);
- data.byte(kGetback) = 1;
+ _getBack = 1;
}
-void DreamGenContext::openRyan() {
+void DreamWebEngine::openRyan() {
enterCode(5, 1, 0, 6);
- data.byte(kGetback) = 1;
+ _getBack = 1;
}
-void DreamGenContext::openPoolBoss() {
+void DreamWebEngine::openPoolBoss() {
enterCode(5, 2, 2, 2);
- data.byte(kGetback) = 1;
+ _getBack = 1;
}
-void DreamGenContext::openEden() {
+void DreamWebEngine::openEden() {
enterCode(2, 8, 6, 5);
- data.byte(kGetback) = 1;
+ _getBack = 1;
}
-void DreamGenContext::openSarters() {
+void DreamWebEngine::openSarters() {
enterCode(7, 8, 3, 3);
- data.byte(kGetback) = 1;
+ _getBack = 1;
}
-void DreamGenContext::openLouis() {
+void DreamWebEngine::openLouis() {
enterCode(5, 2, 3, 8);
- data.byte(kGetback) = 1;
+ _getBack = 1;
}
-void DreamGenContext::useWall() {
+void DreamWebEngine::useWall() {
showFirstUse();
- if (data.byte(kManspath) != 3) {
- data.word(kWatchingtime) = 30*2;
- data.word(kReeltowatch) = 2;
- data.word(kEndwatchreel) = 31;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
- data.byte(kGetback) = 1;
+ if (_mansPath != 3) {
+ _vars._watchingTime = 30*2;
+ _vars._reelToWatch = 2;
+ _vars._endWatchReel = 31;
+ _vars._watchSpeed = 1;
+ _vars._speedCount = 1;
+ _getBack = 1;
turnPathOn(3);
turnPathOn(4);
turnPathOff(0);
turnPathOff(1);
turnPathOff(2);
turnPathOff(5);
- data.byte(kManspath) = 3;
- data.byte(kFinaldest) = 3;
+ _mansPath = 3;
+ _finalDest = 3;
findXYFromPath();
- data.byte(kResetmanxy) = 1;
+ _resetManXY = 1;
switchRyanOff();
} else {
// Go back over
- data.word(kWatchingtime) = 30 * 2;
- data.word(kReeltowatch) = 34;
- data.word(kEndwatchreel) = 60;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
- data.byte(kGetback) = 1;
+ _vars._watchingTime = 30 * 2;
+ _vars._reelToWatch = 34;
+ _vars._endWatchReel = 60;
+ _vars._watchSpeed = 1;
+ _vars._speedCount = 1;
+ _getBack = 1;
turnPathOff(3);
turnPathOff(4);
turnPathOn(0);
turnPathOn(1);
turnPathOn(2);
turnPathOn(5);
- data.byte(kManspath) = 5;
- data.byte(kFinaldest) = 5;
+ _mansPath = 5;
+ _finalDest = 5;
findXYFromPath();
- data.byte(kResetmanxy) = 1;
+ _resetManXY = 1;
switchRyanOff();
}
}
-void DreamGenContext::useLadder() {
+void DreamWebEngine::useLadder() {
showFirstUse();
- data.byte(kMapx) = data.byte(kMapx) - 11;
+ _mapX = _mapX - 11;
findRoomInLoc();
- data.byte(kFacing) = 6;
- data.byte(kTurntoface) = 6;
- data.byte(kManspath) = 0;
- data.byte(kDestination) = 0;
- data.byte(kFinaldest) = 0;
+ _facing = 6;
+ _turnToFace = 6;
+ _mansPath = 0;
+ _destination = 0;
+ _finalDest = 0;
findXYFromPath();
- data.byte(kResetmanxy) = 1;
- data.byte(kGetback) = 1;
+ _resetManXY = 1;
+ _getBack = 1;
}
-void DreamGenContext::useLadderB() {
+void DreamWebEngine::useLadderB() {
showFirstUse();
- data.byte(kMapx) = data.byte(kMapx) + 11;
+ _mapX = _mapX + 11;
findRoomInLoc();
- data.byte(kFacing) = 2;
- data.byte(kTurntoface) = 2;
- data.byte(kManspath) = 1;
- data.byte(kDestination) = 1;
- data.byte(kFinaldest) = 1;
+ _facing = 2;
+ _turnToFace = 2;
+ _mansPath = 1;
+ _destination = 1;
+ _finalDest = 1;
findXYFromPath();
- data.byte(kResetmanxy) = 1;
- data.byte(kGetback) = 1;
+ _resetManXY = 1;
+ _getBack = 1;
}
-void DreamGenContext::sLabDoorA() {
+void DreamWebEngine::slabDoorA() {
showFirstUse();
- data.byte(kGetback) = 1;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
- data.word(kReeltowatch) = 13;
- if (data.byte(kDreamnumber) != 3) {
+ _getBack = 1;
+ _vars._watchSpeed = 1;
+ _vars._speedCount = 1;
+ _vars._reelToWatch = 13;
+ if (_vars._dreamNumber != 3) {
// Wrong
- data.word(kWatchingtime) = 40;
- data.word(kEndwatchreel) = 34;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
+ _vars._watchingTime = 40;
+ _vars._endWatchReel = 34;
+ _vars._watchSpeed = 1;
+ _vars._speedCount = 1;
} else {
- data.byte(kProgresspoints)++;
- data.word(kWatchingtime) = 60;
- data.word(kEndwatchreel) = 42;
- data.byte(kNewlocation) = 47;
+ _vars._progressPoints++;
+ _vars._watchingTime = 60;
+ _vars._endWatchReel = 42;
+ _newLocation = 47;
}
}
-void DreamGenContext::sLabDoorB() {
- if (data.byte(kDreamnumber) != 1) {
+void DreamWebEngine::slabDoorB() {
+ if (_vars._dreamNumber != 1) {
// Wrong
showFirstUse();
- data.byte(kGetback) = 1;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
- data.word(kReeltowatch) = 44;
- data.word(kWatchingtime) = 40;
- data.word(kEndwatchreel) = 63;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
+ _getBack = 1;
+ _vars._watchSpeed = 1;
+ _vars._speedCount = 1;
+ _vars._reelToWatch = 44;
+ _vars._watchingTime = 40;
+ _vars._endWatchReel = 63;
+ _vars._watchSpeed = 1;
+ _vars._speedCount = 1;
} else {
- al = 'S';
- ah = 'H';
- cl = 'L';
- ch = 'D';
- isRyanHolding();
-
- if (flags.z()) {
+ if (!isRyanHolding("SHLD")) {
// No crystal
showPuzText(44, 200);
putBackObStuff();
} else {
// Got crystal
showFirstUse();
- data.byte(kProgresspoints)++;
- data.byte(kGetback) = 1;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
- data.word(kReeltowatch) = 44;
- data.word(kWatchingtime) = 60;
- data.word(kEndwatchreel) = 71;
- data.byte(kNewlocation) = 47;
+ _vars._progressPoints++;
+ _getBack = 1;
+ _vars._watchSpeed = 1;
+ _vars._speedCount = 1;
+ _vars._reelToWatch = 44;
+ _vars._watchingTime = 60;
+ _vars._endWatchReel = 71;
+ _newLocation = 47;
}
}
}
-void DreamGenContext::sLabDoorC() {
+void DreamWebEngine::slabDoorC() {
showFirstUse();
- data.byte(kGetback) = 1;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
- data.word(kReeltowatch) = 108;
- if (data.byte(kDreamnumber) != 4) {
+ _getBack = 1;
+ _vars._watchSpeed = 1;
+ _vars._speedCount = 1;
+ _vars._reelToWatch = 108;
+ if (_vars._dreamNumber != 4) {
// Wrong
- data.word(kWatchingtime) = 40;
- data.word(kEndwatchreel) = 127;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
+ _vars._watchingTime = 40;
+ _vars._endWatchReel = 127;
+ _vars._watchSpeed = 1;
+ _vars._speedCount = 1;
} else {
- data.byte(kProgresspoints)++;
- data.word(kWatchingtime) = 60;
- data.word(kEndwatchreel) = 135;
- data.byte(kNewlocation) = 47;
+ _vars._progressPoints++;
+ _vars._watchingTime = 60;
+ _vars._endWatchReel = 135;
+ _newLocation = 47;
}
}
-void DreamGenContext::sLabDoorD() {
+void DreamWebEngine::slabDoorD() {
showFirstUse();
- data.byte(kGetback) = 1;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
- data.word(kReeltowatch) = 75;
- if (data.byte(kDreamnumber) != 0) {
+ _getBack = 1;
+ _vars._watchSpeed = 1;
+ _vars._speedCount = 1;
+ _vars._reelToWatch = 75;
+ if (_vars._dreamNumber != 0) {
// Wrong
- data.word(kWatchingtime) = 40;
- data.word(kEndwatchreel) = 94;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
+ _vars._watchingTime = 40;
+ _vars._endWatchReel = 94;
+ _vars._watchSpeed = 1;
+ _vars._speedCount = 1;
} else {
- data.byte(kProgresspoints)++;
- data.word(kWatchingtime) = 60;
- data.word(kEndwatchreel) = 102;
- data.byte(kNewlocation) = 47;
+ _vars._progressPoints++;
+ _vars._watchingTime = 60;
+ _vars._endWatchReel = 102;
+ _newLocation = 47;
}
}
-void DreamGenContext::sLabDoorE() {
+void DreamWebEngine::slabDoorE() {
showFirstUse();
- data.byte(kGetback) = 1;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
- data.word(kReeltowatch) = 141;
- if (data.byte(kDreamnumber) != 5) {
+ _getBack = 1;
+ _vars._watchSpeed = 1;
+ _vars._speedCount = 1;
+ _vars._reelToWatch = 141;
+ if (_vars._dreamNumber != 5) {
// Wrong
- data.word(kWatchingtime) = 40;
- data.word(kEndwatchreel) = 160;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
+ _vars._watchingTime = 40;
+ _vars._endWatchReel = 160;
+ _vars._watchSpeed = 1;
+ _vars._speedCount = 1;
} else {
- data.byte(kProgresspoints)++;
- data.word(kWatchingtime) = 60;
- data.word(kEndwatchreel) = 168;
- data.byte(kNewlocation) = 47;
+ _vars._progressPoints++;
+ _vars._watchingTime = 60;
+ _vars._endWatchReel = 168;
+ _newLocation = 47;
}
}
-void DreamGenContext::sLabDoorF() {
+void DreamWebEngine::slabDoorF() {
showFirstUse();
- data.byte(kGetback) = 1;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
- data.word(kReeltowatch) = 171;
- if (data.byte(kDreamnumber) != 2) {
+ _getBack = 1;
+ _vars._watchSpeed = 1;
+ _vars._speedCount = 1;
+ _vars._reelToWatch = 171;
+ if (_vars._dreamNumber != 2) {
// Wrong
- data.word(kWatchingtime) = 40;
- data.word(kEndwatchreel) = 189;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
+ _vars._watchingTime = 40;
+ _vars._endWatchReel = 189;
+ _vars._watchSpeed = 1;
+ _vars._speedCount = 1;
} else {
- data.byte(kProgresspoints)++;
- data.word(kWatchingtime) = 60;
- data.word(kEndwatchreel) = 197;
- data.byte(kNewlocation) = 47;
+ _vars._progressPoints++;
+ _vars._watchingTime = 60;
+ _vars._endWatchReel = 197;
+ _newLocation = 47;
}
}
-bool DreamGenContext::defaultUseHandler(const char *id) {
- if (data.byte(kWithobject) == 255) {
+bool DreamWebEngine::defaultUseHandler(const char *id) {
+ if (_withObject == 255) {
withWhat();
return true; // event handled
}
- if (!compare(data.byte(kWithobject), data.byte(kWithtype), id)) {
+ if (!compare(_withObject, _withType, id)) {
// Wrong item
showPuzText(14, 300);
putBackObStuff();
@@ -746,79 +707,185 @@ bool DreamGenContext::defaultUseHandler(const char *id) {
return false; // continue with the original event
}
-void DreamGenContext::useChurchGate() {
- char id[4] = { 'C', 'U', 'T', 'T' }; // TODO: convert to string with trailing zero
- if (defaultUseHandler(id))
+void DreamWebEngine::useChurchGate() {
+ if (defaultUseHandler("CUTT"))
return;
// Cut gate
showFirstUse();
- data.word(kWatchingtime) = 64 * 2;
- data.word(kReeltowatch) = 4;
- data.word(kEndwatchreel) = 70;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
- data.byte(kGetback) = 1;
- data.byte(kProgresspoints)++;
+ _vars._watchingTime = 64 * 2;
+ _vars._reelToWatch = 4;
+ _vars._endWatchReel = 70;
+ _vars._watchSpeed = 1;
+ _vars._speedCount = 1;
+ _getBack = 1;
+ _vars._progressPoints++;
turnPathOn(3);
- if (data.byte(kAidedead) != 0)
+ if (_vars._aideDead != 0)
turnPathOn(2); // Open church
}
-void DreamGenContext::useFullCart() {
- data.byte(kProgresspoints)++;
- turnAnyPathOn(2, data.byte(kRoomnum) + 6);
- data.byte(kManspath) = 4;
- data.byte(kFacing) = 4;
- data.byte(kTurntoface) = 4;
- data.byte(kFinaldest) = 4;
+void DreamWebEngine::useGun() {
+
+ if (_objectType != kExObjectType) {
+ // gun is not taken
+ showSecondUse();
+ putBackObStuff();
+
+ } else if (_realLocation == 22) {
+ // in pool room
+ showPuzText(34, 300);
+ _vars._lastWeapon = 1;
+ _vars._combatCount = 39;
+ _getBack = 1;
+ _vars._progressPoints++;
+
+ } else if (_realLocation == 25) {
+ // helicopter
+ showPuzText(34, 300);
+ _vars._lastWeapon = 1;
+ _vars._combatCount = 19;
+ _getBack = 1;
+ _vars._dreamNumber = 2;
+ _vars._roomAfterDream = 38;
+ _vars._sartainDead = 1;
+ _vars._progressPoints++;
+
+ } else if (_realLocation == 27) {
+ // in rock room
+ showPuzText(46, 300);
+ _pointerMode = 2;
+ _vars._rockstarDead = 1;
+ _vars._lastWeapon = 1;
+ _vars._newsItem = 1;
+ _getBack = 1;
+ _vars._roomAfterDream = 32;
+ _vars._dreamNumber = 0;
+ _vars._progressPoints++;
+
+ } else if (_realLocation == 8 && _mapX == 22 && _mapY == 40
+ && !isSetObOnMap(92) && _mansPath != 9) {
+ // by studio
+ _destination = 9;
+ _finalDest = 9;
+ autoSetWalk();
+ _vars._lastWeapon = 1;
+ _getBack = 1;
+ _vars._progressPoints++;
+
+ } else if (_realLocation == 6 && _mapX == 11 && _mapY == 20
+ && isSetObOnMap(5)) {
+ // sarters
+ _destination = 1;
+ _finalDest = 1;
+ autoSetWalk();
+ removeSetObject(5);
+ placeSetObject(6);
+ turnAnyPathOn(1, _roomNum - 1);
+ _vars._liftFlag = 1;
+ _vars._watchingTime = 40*2;
+ _vars._reelToWatch = 4;
+ _vars._endWatchReel = 43;
+ _vars._watchSpeed = 1;
+ _vars._speedCount = 1;
+ _getBack = 1;
+ _vars._progressPoints++;
+
+ } else if (_realLocation == 29) {
+ // aide
+ _getBack = 1;
+ resetLocation(13);
+ setLocation(12);
+ _destPos = 12;
+ _destination = 2;
+ _finalDest = 2;
+ autoSetWalk();
+ _vars._watchingTime = 164*2;
+ _vars._reelToWatch = 3;
+ _vars._endWatchReel = 164;
+ _vars._watchSpeed = 1;
+ _vars._speedCount = 1;
+ _vars._aideDead = 1;
+ _vars._dreamNumber = 3;
+ _vars._roomAfterDream = 33;
+ _vars._progressPoints++;
+
+ } else if (_realLocation == 23 && _mapX == 0 && _mapY == 50) {
+ // with boss
+ if (_mansPath != 5) {
+ _destination = 5;
+ _finalDest = 5;
+ autoSetWalk();
+ }
+ _vars._lastWeapon = 1;
+ _getBack = 1;
+
+ } else if (_realLocation == 8 && _mapX == 11 && _mapY == 10) {
+ // tv soldier
+ if (_mansPath != 2) {
+ _destination = 2;
+ _finalDest = 2;
+ autoSetWalk();
+ }
+ _vars._lastWeapon = 1;
+ _getBack = 1;
+
+ } else {
+ showFirstUse();
+ putBackObStuff();
+ }
+}
+
+void DreamWebEngine::useFullCart() {
+ _vars._progressPoints++;
+ turnAnyPathOn(2, _roomNum + 6);
+ _mansPath = 4;
+ _facing = 4;
+ _turnToFace = 4;
+ _finalDest = 4;
findXYFromPath();
- data.byte(kResetmanxy) = 1;
+ _resetManXY = 1;
showFirstUse();
- data.word(kWatchingtime) = 72 * 2;
- data.word(kReeltowatch) = 58;
- data.word(kEndwatchreel) = 142;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
- data.byte(kGetback) = 1;
+ _vars._watchingTime = 72 * 2;
+ _vars._reelToWatch = 58;
+ _vars._endWatchReel = 142;
+ _vars._watchSpeed = 1;
+ _vars._speedCount = 1;
+ _getBack = 1;
}
-void DreamGenContext::useClearBox() {
- char id[4] = { 'R', 'A', 'I', 'L' }; // TODO: convert to string with trailing zero
- if (defaultUseHandler(id))
+void DreamWebEngine::useClearBox() {
+ if (defaultUseHandler("RAIL"))
return;
// Open box
- data.byte(kProgresspoints)++;
+ _vars._progressPoints++;
showFirstUse();
- data.word(kWatchingtime) = 80;
- data.word(kReeltowatch) = 67;
- data.word(kEndwatchreel) = 105;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
- data.byte(kGetback) = 1;
+ _vars._watchingTime = 80;
+ _vars._reelToWatch = 67;
+ _vars._endWatchReel = 105;
+ _vars._watchSpeed = 1;
+ _vars._speedCount = 1;
+ _getBack = 1;
}
-void DreamGenContext::openTVDoor() {
- char id[4] = { 'U', 'L', 'O', 'K' }; // TODO: convert to string with trailing zero
- if (defaultUseHandler(id))
+void DreamWebEngine::openTVDoor() {
+ if (defaultUseHandler("ULOK"))
return;
// Key on TV
showFirstUse();
- data.byte(kLockstatus) = 0;
- data.byte(kGetback) = 1;
+ _vars._lockStatus = 0;
+ _getBack = 1;
}
-void DreamGenContext::usePlate() {
- if (data.byte(kWithobject) == 255) {
+void DreamWebEngine::usePlate() {
+ if (_withObject == 255) {
withWhat();
return;
}
- char screw[4] = { 'S', 'C', 'R', 'W' }; // TODO: convert to string with trailing zero
- char knife[4] = { 'K', 'N', 'F', 'E' }; // TODO: convert to string with trailing zero
- if (compare(data.byte(kWithobject), data.byte(kWithtype), screw)) {
+ if (compare(_withObject, _withType, "SCRW")) {
// Unscrew plate
playChannel1(20);
showFirstUse();
@@ -826,9 +893,9 @@ void DreamGenContext::usePlate() {
placeSetObject(24);
removeSetObject(25);
placeFreeObject(0);
- data.byte(kProgresspoints)++;
- data.byte(kGetback) = 1;
- } else if (compare(data.byte(kWithobject), data.byte(kWithtype), knife)) {
+ _vars._progressPoints++;
+ _getBack = 1;
+ } else if (compare(_withObject, _withType, "KNFE")) {
// Tried knife
showPuzText(54, 300);
putBackObStuff();
@@ -839,152 +906,143 @@ void DreamGenContext::usePlate() {
}
}
-void DreamGenContext::usePlinth() {
- if (data.byte(kWithobject) == 255) {
+void DreamWebEngine::usePlinth() {
+ if (_withObject == 255) {
withWhat();
return;
}
- char id[4] = { 'D', 'K', 'E', 'Y' }; // TODO: convert to string with trailing zero
- if (!compare(data.byte(kWithobject), data.byte(kWithtype), id)) {
+ if (!compare(_withObject, _withType, "DKEY")) {
// Wrong key
showFirstUse();
putBackObStuff();
} else {
- data.byte(kProgresspoints)++;
+ _vars._progressPoints++;
showSecondUse();
- data.word(kWatchingtime) = 220;
- data.word(kReeltowatch) = 0;
- data.word(kEndwatchreel) = 104;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
- data.byte(kGetback) = 1;
- data.byte(kNewlocation) = data.byte(kRoomafterdream);
+ _vars._watchingTime = 220;
+ _vars._reelToWatch = 0;
+ _vars._endWatchReel = 104;
+ _vars._watchSpeed = 1;
+ _vars._speedCount = 1;
+ _getBack = 1;
+ _newLocation = _vars._roomAfterDream;
}
}
-void DreamGenContext::useElvDoor() {
- char id[4] = { 'A', 'X', 'E', 'D' }; // TODO: convert to string with trailing zero
- if (defaultUseHandler(id))
+void DreamWebEngine::useElvDoor() {
+ if (defaultUseHandler("AXED"))
return;
// Axe on door
showPuzText(15, 300);
- _inc(data.byte(kProgresspoints));
- data.word(kWatchingtime) = 46 * 2;
- data.word(kReeltowatch) = 31;
- data.word(kEndwatchreel) = 77;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
- data.byte(kGetback) = 1;
+ _vars._progressPoints++;
+ _vars._watchingTime = 46 * 2;
+ _vars._reelToWatch = 31;
+ _vars._endWatchReel = 77;
+ _vars._watchSpeed = 1;
+ _vars._speedCount = 1;
+ _getBack = 1;
}
-void DreamGenContext::useObject() {
- data.byte(kWithobject) = 255;
+void DreamWebEngine::useObject() {
+ _withObject = 255;
- if (data.byte(kCommandtype) != 229) {
- data.byte(kCommandtype) = 229;
- commandWithOb(51, data.byte(kObjecttype), data.byte(kCommand));
+ if (_commandType != 229) {
+ _commandType = 229;
+ commandWithOb(51, _objectType, _command);
}
- if (data.word(kMousebutton) == data.word(kOldbutton))
+ if (_mouseButton == _oldButton)
return; // nouse
- if (data.word(kMousebutton) & 1)
+ if (_mouseButton & 1)
useRoutine();
}
-void DreamGenContext::useWinch() {
- al = 40;
- ah = 1;
- checkInside();
-
- char id[4] = { 'F', 'U', 'S', 'E' }; // TODO: convert to string with trailing zero
- if (cl == kNumexobjects || !compare(cl, 4, id)) {
+void DreamWebEngine::useWinch() {
+ uint16 contentIndex = checkInside(40, 1);
+ if (contentIndex == kNumexobjects || !compare(contentIndex, kExObjectType, "FUSE")) {
// No winch
showFirstUse();
putBackObStuff();
return;
}
- data.word(kWatchingtime) = 217 * 2;
- data.word(kReeltowatch) = 0;
- data.word(kEndwatchreel) = 217;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
- data.byte(kDestpos) = 1;
- data.byte(kNewlocation) = 45;
- data.byte(kDreamnumber) = 1;
- data.byte(kRoomafterdream) = 44;
- data.byte(kGeneraldead) = 1;
- data.byte(kNewsitem) = 2;
- data.byte(kGetback) = 1;
- data.byte(kProgresspoints)++;
-}
-
-void DreamGenContext::useCart() {
- char id[4] = { 'R', 'O', 'C', 'K' }; // TODO: convert to string with trailing zero
- if (defaultUseHandler(id))
+ _vars._watchingTime = 217 * 2;
+ _vars._reelToWatch = 0;
+ _vars._endWatchReel = 217;
+ _vars._watchSpeed = 1;
+ _vars._speedCount = 1;
+ _destPos = 1;
+ _newLocation = 45;
+ _vars._dreamNumber = 1;
+ _vars._roomAfterDream = 44;
+ _vars._generalDead = 1;
+ _vars._newsItem = 2;
+ _getBack = 1;
+ _vars._progressPoints++;
+}
+
+void DreamWebEngine::useCart() {
+ if (defaultUseHandler("ROCK"))
return;
- DynObject *exObject = getExAd(data.byte(kWithobject));
+ DynObject *exObject = getExAd(_withObject);
exObject->mapad[0] = 0;
- removeSetObject(data.byte(kCommand));
- placeSetObject(data.byte(kCommand) + 1);
- data.byte(kProgresspoints)++;
+ removeSetObject(_command);
+ placeSetObject(_command + 1);
+ _vars._progressPoints++;
playChannel1(17);
showFirstUse();
- data.byte(kGetback) = 1;
+ _getBack = 1;
}
-void DreamGenContext::useTrainer() {
- // TODO: Use the C++ version of getAnyAd()
- getAnyAd();
- if (es.byte(bx + 2) != 4) {
+void DreamWebEngine::useTrainer() {
+ uint8 dummy;
+ DynObject *object = (DynObject *)getAnyAd(&dummy, &dummy);
+ if (object->mapad[0] != 4) {
notHeldError();
} else {
- data.byte(kProgresspoints)++;
- makeWorn();
+ _vars._progressPoints++;
+ makeWorn(object);
showSecondUse();
putBackObStuff();
}
}
-void DreamGenContext::chewy() {
+void DreamWebEngine::chewy() {
+ // Chewing a gum
showFirstUse();
- // TODO: Use the C++ version of getAnyAd()
- getAnyAd();
- es.byte(bx + 2) = 255;
- data.byte(kGetback) = 1;
+ uint8 dummy;
+ DynObject *object = (DynObject *)getAnyAd(&dummy, &dummy);
+ object->mapad[0] = 255;
+ _getBack = 1;
}
-void DreamGenContext::useHole() {
- char id[4] = { 'H', 'N', 'D', 'A' }; // TODO: convert to string with trailing zero
- if (defaultUseHandler(id))
+void DreamWebEngine::useHole() {
+ if (defaultUseHandler("HNDA"))
return;
showFirstUse();
removeSetObject(86);
- DynObject *exObject = getExAd(data.byte(kWithobject));
+ DynObject *exObject = getExAd(_withObject);
exObject->mapad[0] = 255;
- data.byte(kCanmovealtar) = 1;
- data.byte(kGetback) = 1;
+ _vars._canMoveAltar = 1;
+ _getBack = 1;
}
-void DreamGenContext::openHotelDoor() {
- char id[4] = { 'K', 'E', 'Y', 'A' }; // TODO: convert to string with trailing zero
- if (defaultUseHandler(id))
+void DreamWebEngine::openHotelDoor() {
+ if (defaultUseHandler("KEYA"))
return;
playChannel1(16);
showFirstUse();
- data.byte(kLockstatus) = 0;
- data.byte(kGetback) = 1;
+ _vars._lockStatus = 0;
+ _getBack = 1;
}
-void DreamGenContext::openHotelDoor2() {
- char id[4] = { 'K', 'E', 'Y', 'A' }; // TODO: convert to string with trailing zero
- if (defaultUseHandler(id))
+void DreamWebEngine::openHotelDoor2() {
+ if (defaultUseHandler("KEYA"))
return;
playChannel1(16);
@@ -992,42 +1050,39 @@ void DreamGenContext::openHotelDoor2() {
putBackObStuff();
}
-void DreamGenContext::grafittiDoor() {
- char id[4] = { 'A', 'P', 'E', 'N' }; // TODO: convert to string with trailing zero
- if (defaultUseHandler(id))
+void DreamWebEngine::grafittiDoor() {
+ if (defaultUseHandler("APEN"))
return;
showFirstUse();
putBackObStuff();
}
-void DreamGenContext::usePoolReader() {
- char id[4] = { 'M', 'E', 'M', 'B' }; // TODO: convert to string with trailing zero
- if (defaultUseHandler(id))
+void DreamWebEngine::usePoolReader() {
+ if (defaultUseHandler("MEMB"))
return;
- if (data.byte(kTalkedtoattendant) != 1) {
+ if (_vars._talkedToAttendant != 1) {
// Can't open pool
showSecondUse();
putBackObStuff();
} else {
playChannel1(17);
showFirstUse();
- data.byte(kCounttoopen) = 6;
- data.byte(kGetback) = 1;
+ _vars._countToOpen = 6;
+ _getBack = 1;
}
}
-void DreamGenContext::useCardReader1() {
- char id[4] = { 'C', 'S', 'H', 'R' }; // TODO: convert to string with trailing zero
- if (defaultUseHandler(id))
+void DreamWebEngine::useCardReader1() {
+ if (defaultUseHandler("CSHR"))
return;
- if (data.byte(kTalkedtosparky) == 0) {
+ if (_vars._talkedToSparky == 0) {
// Not yet
showFirstUse();
putBackObStuff();
- } else if (data.word(kCard1money) != 0) {
+ } else if (_vars._card1Money != 0) {
// No cash
showPuzText(17, 300);
putBackObStuff();
@@ -1035,26 +1090,25 @@ void DreamGenContext::useCardReader1() {
// Get cash
playChannel1(16);
showPuzText(18, 300);
- data.byte(kProgresspoints)++;
- data.word(kCard1money) = 12432;
- data.byte(kGetback) = 1;
+ _vars._progressPoints++;
+ _vars._card1Money = 12432;
+ _getBack = 1;
}
}
-void DreamGenContext::useCardReader2() {
- char id[4] = { 'C', 'S', 'H', 'R' }; // TODO: convert to string with trailing zero
- if (defaultUseHandler(id))
+void DreamWebEngine::useCardReader2() {
+ if (defaultUseHandler("CSHR"))
return;
- if (data.byte(kTalkedtoboss) == 0) {
+ if (_vars._talkedToBoss == 0) {
// Haven't talked to boss
showFirstUse();
putBackObStuff();
- } else if (data.byte(kCard1money) == 0) {
+ } else if (_vars._card1Money == 0) {
// No cash
showPuzText(20, 300);
putBackObStuff();
- } else if (data.byte(kGunpassflag) == 2) {
+ } else if (_vars._gunPassFlag == 2) {
// Already got new
showPuzText(22, 300);
putBackObStuff();
@@ -1062,72 +1116,68 @@ void DreamGenContext::useCardReader2() {
playChannel1(18);
showPuzText(19, 300);
placeSetObject(94);
- data.byte(kGunpassflag) = 1;
- data.word(kCard1money) -= 2000;
- data.byte(kProgresspoints)++;
- data.byte(kGetback) = 1;
+ _vars._gunPassFlag = 1;
+ _vars._card1Money -= 2000;
+ _vars._progressPoints++;
+ _getBack = 1;
}
}
-void DreamGenContext::useCardReader3() {
- char id[4] = { 'C', 'S', 'H', 'R' }; // TODO: convert to string with trailing zero
- if (defaultUseHandler(id))
+void DreamWebEngine::useCardReader3() {
+ if (defaultUseHandler("CSHR"))
return;
- if (data.byte(kTalkedtorecep) == 0) {
+ if (_vars._talkedToRecep == 0) {
// Haven't talked to receptionist
showFirstUse();
putBackObStuff();
- } else if (data.byte(kCardpassflag) != 0) {
+ } else if (_vars._cardPassFlag != 0) {
// Already used it
showPuzText(26, 300);
putBackObStuff();
} else {
playChannel1(16);
showPuzText(25, 300);
- data.byte(kProgresspoints)++;
- data.word(kCard1money) -= 8300;
- data.byte(kCardpassflag) = 1;
- data.byte(kGetback) = 1;
+ _vars._progressPoints++;
+ _vars._card1Money -= 8300;
+ _vars._cardPassFlag = 1;
+ _getBack = 1;
}
}
-void DreamGenContext::useLighter() {
- if (data.byte(kWithobject) == 255) {
+void DreamWebEngine::useLighter() {
+ if (_withObject == 255) {
withWhat();
return;
}
- char id[4] = { 'S', 'M', 'K', 'E' }; // TODO: convert to string with trailing zero
- if (!compare(data.byte(kWithobject), data.byte(kWithtype), id)) {
+ if (!compare(_withObject, _withType, "SMKE")) {
showFirstUse();
putBackObStuff();
} else {
showPuzText(9, 300);
- DynObject *withObj = getExAd(data.byte(kWithobject));
+ DynObject *withObj = getExAd(_withObject);
withObj->mapad[0] = 255;
- data.byte(kGetback) = 1;
+ _getBack = 1;
}
}
-void DreamGenContext::useWire() {
- if (data.byte(kWithobject) == 255) {
+void DreamWebEngine::useWire() {
+ if (_withObject == 255) {
withWhat();
return;
}
- char knife[4] = { 'K', 'N', 'F', 'E' }; // TODO: convert to string with trailing zero
- if (compare(data.byte(kWithobject), data.byte(kWithtype), knife)) {
+ if (compare(_withObject, _withType, "KNFE")) {
removeSetObject(51);
placeSetObject(52);
showPuzText(11, 300);
- data.byte(kProgresspoints)++;
- data.byte(kGetback) = 1;
+ _vars._progressPoints++;
+ _getBack = 1;
return;
}
- char axe[4] = { 'A', 'X', 'E', 'D' }; // TODO: convert to string with trailing zero
- if (compare(data.byte(kWithobject), data.byte(kWithtype), axe)) {
+ if (compare(_withObject, _withType, "AXED")) {
showPuzText(16, 300);
putBackObStuff();
return;
@@ -1137,19 +1187,19 @@ void DreamGenContext::useWire() {
putBackObStuff();
}
-void DreamGenContext::openTomb() {
- data.byte(kProgresspoints)++;
+void DreamWebEngine::openTomb() {
+ _vars._progressPoints++;
showFirstUse();
- data.word(kWatchingtime) = 35 * 2;
- data.word(kReeltowatch) = 1;
- data.word(kEndwatchreel) = 33;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
- data.byte(kGetback) = 1;
+ _vars._watchingTime = 35 * 2;
+ _vars._reelToWatch = 1;
+ _vars._endWatchReel = 33;
+ _vars._watchSpeed = 1;
+ _vars._speedCount = 1;
+ _getBack = 1;
}
-void DreamGenContext::hotelControl() {
- if (data.byte(kReallocation) != 21 || data.byte(kMapx) != 33)
+void DreamWebEngine::hotelControl() {
+ if (_realLocation != 21 || _mapX != 33)
showSecondUse(); // Not right control
else
showFirstUse();
@@ -1157,71 +1207,393 @@ void DreamGenContext::hotelControl() {
putBackObStuff();
}
-void DreamGenContext::useCooker() {
- al = data.byte(kCommand);
- ah = data.byte(kObjecttype);
- checkInside();
-
- if (cl == 114)
+void DreamWebEngine::useCooker() {
+ if (checkInside(_command, _objectType) == kNumexobjects)
showFirstUse();
else
showSecondUse(); // Food inside
-
+
putBackObStuff();
}
-void DreamBase::placeFreeObject(uint8 index) {
+void DreamWebEngine::placeFreeObject(uint8 index) {
findOrMake(index, 0, 1);
getFreeAd(index)->mapad[0] = 0;
}
-void DreamBase::removeFreeObject(uint8 index) {
+void DreamWebEngine::removeFreeObject(uint8 index) {
getFreeAd(index)->mapad[0] = 0xFF;
}
-void DreamGenContext::useDiary() {
- getRidOfReels();
- loadIntoTemp("DREAMWEB.G14");
- loadTempText("DREAMWEB.T51");
- loadTempCharset("DREAMWEB.C02");
+void DreamWebEngine::useControl() {
+ if (_withObject == 255) {
+ withWhat();
+ return;
+ }
+
+ if (compare(_withObject, _withType, "KEYA")) { // Right key
+ playChannel1(16);
+ if (_vars._location == 21) { // Going down
+ showPuzText(3, 300);
+ _newLocation = 30;
+ } else {
+ showPuzText(0, 300);
+ _newLocation = 21;
+ }
+
+ _vars._countToClose = 8;
+ _vars._countToOpen = 0;
+ _vars._watchingTime = 80;
+ _getBack = 1;
+ return;
+ }
+
+ if (_realLocation == 21) {
+ if (compare(_withObject, _withType, "KNFE")) {
+ // Jimmy controls
+ placeSetObject(50);
+ placeSetObject(51);
+ placeSetObject(26);
+ placeSetObject(30);
+ removeSetObject(16);
+ removeSetObject(17);
+ playChannel1(14);
+ showPuzText(10, 300);
+ _vars._progressPoints++;
+ _getBack = 1;
+ } else if (compare(_withObject, _withType, "AXED")) {
+ // Axe on controls
+ showPuzText(16, 300);
+ _vars._progressPoints++;
+ putBackObStuff();
+ } else {
+ // Balls
+ showFirstUse();
+ putBackObStuff();
+ }
+ } else {
+ // Balls
+ showFirstUse();
+ putBackObStuff();
+ }
+}
+
+void DreamWebEngine::useSlab() {
+ if (_withObject == 255) {
+ withWhat();
+ return;
+ }
+
+ if (!compare(_withObject, _withType, "JEWL")) {
+ showPuzText(14, 300);
+ putBackObStuff();
+ return;
+ }
+
+ DynObject *exObject = getExAd(_withObject);
+ exObject->mapad[0] = 0;
+
+ removeSetObject(_command);
+ placeSetObject(_command + 1);
+ if (_command + 1 == 54) {
+ // Last slab
+ turnPathOn(0);
+ _vars._watchingTime = 22;
+ _vars._reelToWatch = 35;
+ _vars._endWatchReel = 48;
+ _vars._watchSpeed = 1;
+ _vars._speedCount = 1;
+ }
+
+ _vars._progressPoints++;
+ showFirstUse();
+ _getBack = 1;
+}
+
+void DreamWebEngine::usePipe() {
+ if (_withObject == 255) {
+ withWhat();
+ return;
+ }
+
+ if (compare(_withObject, _withType, "CUPE")) {
+ // Fill cup
+ showPuzText(36, 300);
+ putBackObStuff();
+ DynObject *exObject = getExAd(_withObject);
+ exObject->objId[3] = 'F'-'A'; // CUPE (empty cup) -> CUPF (full cup)
+ return;
+ } else if (compare(_withObject, _withType, "CUPF")) {
+ // Already full
+ showPuzText(35, 300);
+ putBackObStuff();
+ } else {
+ showPuzText(14, 300);
+ putBackObStuff();
+ }
+}
+
+void DreamWebEngine::useOpenBox() {
+ if (_withObject == 255) {
+ withWhat();
+ return;
+ }
+
+ if (compare(_withObject, _withType, "CUPF")) {
+ // Destroy open box
+ _vars._progressPoints++;
+ showPuzText(37, 300);
+ DynObject *exObject = getExAd(_withObject);
+ exObject->objId[3] = 'E'-'A'; // CUPF (full cup) -> CUPE (empty cup)
+ _vars._watchingTime = 140;
+ _vars._reelToWatch = 105;
+ _vars._endWatchReel = 181;
+ _vars._watchSpeed = 1;
+ _vars._speedCount = 1;
+ turnPathOn(4);
+ _getBack = 1;
+ return;
+ }
+
+ if (compare(_withObject, _withType, "CUPE")) {
+ // Open box wrong
+ showPuzText(38, 300);
+ putBackObStuff();
+ return;
+ }
+
+ showFirstUse();
+}
+
+void DreamWebEngine::runTap() {
+ if (_withObject == 255) {
+ withWhat();
+ return;
+ }
+
+ if (compare(_withObject, _withType, "CUPE")) {
+ // Fill cup from tap
+ DynObject *exObject = getExAd(_withObject);
+ exObject->objId[3] = 'F'-'A'; // CUPE (empty cup) -> CUPF (full cup)
+ playChannel1(8);
+ showPuzText(57, 300);
+ putBackObStuff();
+ return;
+ }
+
+ if (compare(_withObject, _withType, "CUPF")) {
+ // Cup from tap full
+ showPuzText(58, 300);
+ putBackObStuff();
+ return;
+ }
+
+ showPuzText(56, 300);
+ putBackObStuff();
+}
+
+void DreamWebEngine::useAxe() {
+ if (_realLocation != 22) {
+ // Not in pool
+ showFirstUse();
+ return;
+ }
+
+ if (_mapY == 10) {
+ // Axe on door
+ showPuzText(15, 300);
+ _vars._progressPoints++;
+ _vars._watchingTime = 46*2;
+ _vars._reelToWatch = 31;
+ _vars._endWatchReel = 77;
+ _vars._watchSpeed = 1;
+ _vars._speedCount = 1;
+ _getBack = 1;
+ return;
+ }
+
+ showSecondUse();
+ _vars._progressPoints++;
+ _vars._lastWeapon = 2;
+ _getBack = 1;
+ removeObFromInv();
+}
+
+void DreamWebEngine::useHandle() {
+ SetObject *object = getSetAd(findSetObject("CUTW"));
+ if (object->mapad[0] == 255) {
+ // Wire not cut
+ showPuzText(12, 300);
+ } else {
+ // Wire has been cut
+ showPuzText(13, 300);
+ _newLocation = 22;
+ }
+
+ _getBack = 1;
+}
+
+void DreamWebEngine::useAltar() {
+ if (findExObject("CNDA") == 114 || findExObject("CNDB") == 114) {
+ // Things on altar
+ showFirstUse();
+ _getBack = 1;
+ return;
+ }
+
+ if (_vars._canMoveAltar == 1) {
+ // Move altar
+ _vars._progressPoints++;
+ showSecondUse();
+ _vars._watchingTime = 160;
+ _vars._reelToWatch = 81;
+ _vars._endWatchReel = 174;
+ _vars._watchSpeed = 1;
+ _vars._speedCount = 1;
+ setupTimedUse(47, 32, 98, 52, 76);
+ _getBack = 1;
+ } else {
+ showPuzText(23, 300);
+ _getBack = 1;
+ }
+}
+
+void DreamWebEngine::withWhat() {
+ uint8 commandLine[64] = "OBJECT NAME ONE ";
+
createPanel();
- showIcon();
- showDiary();
- underTextLine();
- showDiaryPage();
+ showPanel();
+ showMan();
+ showExit();
+
+ copyName(_objectType, _command, commandLine);
+ printMessage2(100, 21, 63, 200, false, 2);
+ uint16 x = _lastXPos + 5;
+ printDirect(commandLine, x, 21, 220, false);
+ printMessage2(_lastXPos + 5, 21, 63, 200, false, 3);
+
+ fillRyan();
+ _commandType = 255;
readMouse();
showPointer();
- workToScreenCPP();
+ workToScreen();
delPointer();
- data.byte(kGetback) = 0;
-
- RectWithCallback diaryList[] = {
- { kDiaryx+94,kDiaryx+110,kDiaryy+97,kDiaryy+113,&DreamGenContext::diaryKeyN },
- { kDiaryx+151,kDiaryx+167,kDiaryy+71,kDiaryy+87,&DreamGenContext::diaryKeyP },
- { kDiaryx+176,kDiaryx+192,kDiaryy+108,kDiaryy+124,&DreamGenContext::quitKey },
- { 0,320,0,200,&DreamGenContext::blank },
- { 0xFFFF,0,0,0,0 }
- };
-
- do {
- delPointer();
- readMouse();
- showDiaryKeys();
- showPointer();
- vSync();
- dumpPointer();
- dumpDiaryKeys();
- dumpTextLine();
- checkCoords(diaryList);
- } while (!data.byte(kGetback));
-
- getRidOfTemp();
- getRidOfTempText();
- getRidOfTempCharset();
+ _invOpen = 2;
+}
+
+void DreamWebEngine::notHeldError() {
+ createPanel();
+ showPanel();
+ showMan();
+ showExit();
+ obIcons();
+ printMessage2(64, 100, 63, 200 + 1, true, 1);
+ workToScreenM();
+ hangOnP(50);
+ putBackObStuff();
+}
+
+void DreamWebEngine::useCashCard() {
+ getRidOfReels();
+ loadKeypad();
+ createPanel();
+ showPanel();
+ showExit();
+ showMan();
+ uint16 y = (!_foreignRelease) ? 120 : 120 - 3;
+ showFrame(_keypadGraphics, 114, y, 39, 0);
+ const uint8 *obText = getObTextStart();
+ findNextColon(&obText);
+ findNextColon(&obText);
+ y = 98;
+ printDirect(&obText, 36, &y, 36, 36 & 1);
+ char amountStr[10];
+ sprintf(amountStr, "%04d", _vars._card1Money / 10);
+ _charShift = 91 * 2 + 75;
+ printDirect((const uint8 *)amountStr, 160, 155, 240, 240 & 1);
+ sprintf(amountStr, "%02d", (_vars._card1Money % 10) * 10);
+ _charShift = 91 * 2 + 85;
+ printDirect((const uint8 *)amountStr, 187, 155, 240, 240 & 1);
+ _charShift = 0;
+ workToScreenM();
+ hangOnP(400);
+ _keypadGraphics.clear();
restoreReels();
- data.byte(kManisoffscreen) = 0;
- redrawMainScrn();
+ putBackObStuff();
+}
+
+void DreamWebEngine::useStereo() {
+ // Handles the stereo in Ryan's apartment (accessible from the remote on
+ // the couch)
+
+ if (_vars._location != 0) {
+ showPuzText(4, 400);
+ putBackObStuff();
+ } else if (_mapX != 11) {
+ showPuzText(5, 400);
+ putBackObStuff();
+ } else if (checkInside(findSetObject("CDPL"), 1) == kNumexobjects) {
+ // No CD inside
+ showPuzText(6, 400);
+ putBackObStuff();
+ uint8 dummy;
+ DynObject *object = (DynObject *)getAnyAd(&dummy, &dummy);
+ object->turnedOn = 255;
+ } else {
+ // CD inside
+ 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();
+ }
+}
+
+uint16 DreamWebEngine::checkInside(uint16 command, uint16 type) {
+ for (uint16 index = 0; index < kNumexobjects; index++) {
+ DynObject *object = getExAd(index);
+ if (object->mapad[1] == command && object->mapad[0] == type)
+ return index;
+ }
+
+ return kNumexobjects;
+}
+
+void DreamWebEngine::showPuzText(uint16 command, uint16 count) {
+ createPanel();
+ showPanel();
+ showMan();
+ showExit();
+ obIcons();
+ const uint8 *string = (const uint8 *)_puzzleText.getString(command);
+ printDirect(string, 36, 104, 241, 241 & 1);
workToScreenM();
+ hangOnP(count);
}
-} // End of namespace DreamGen
+void DreamWebEngine::useButtonA() {
+ if (!isSetObOnMap(95)) {
+ showFirstUse();
+ turnAnyPathOn(0, _roomNum - 1);
+ removeSetObject(9);
+ placeSetObject(95);
+ _vars._watchingTime = 15 * 2;
+ _vars._reelToWatch = 71;
+ _vars._endWatchReel = 85;
+ _vars._watchSpeed = 1;
+ _vars._speedCount = 1;
+ _getBack = 1;
+ _vars._progressPoints++;
+ } else {
+ // Done this bit
+ showSecondUse();
+ putBackObStuff();
+ }
+}
+
+
+} // End of namespace DreamWeb