From d4f845524e72bd9887eaa4fdf01f1fc12ef41860 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 6 Dec 2011 16:46:26 +0200 Subject: DREAMWEB: 'destselect', 'lastdest', 'nextdest', 'putbackobstuff', 'reexfromopen', 'useplate' ported to C++ --- devtools/tasmrecover/tasm-recover | 6 ++ engines/dreamweb/dreamgen.cpp | 184 -------------------------------------- engines/dreamweb/dreamgen.h | 6 -- engines/dreamweb/stubs.cpp | 95 ++++++++++++++++++++ engines/dreamweb/stubs.h | 6 ++ engines/dreamweb/use.cpp | 34 +++++++ 6 files changed, 141 insertions(+), 190 deletions(-) diff --git a/devtools/tasmrecover/tasm-recover b/devtools/tasmrecover/tasm-recover index 577c0c98df..ed03ffdafb 100755 --- a/devtools/tasmrecover/tasm-recover +++ b/devtools/tasmrecover/tasm-recover @@ -229,6 +229,7 @@ generator = cpp(context, "DreamGen", blacklist = [ 'delsprite', 'deltextline', 'delthisone', + 'destselect', 'disablepath', 'dmaend', 'doblocks', @@ -350,6 +351,7 @@ generator = cpp(context, "DreamGen", blacklist = [ 'isitright', 'isitworn', 'kernchars', + 'lastdest', 'lastfolder', 'liftnoise', 'liftsprite', @@ -409,6 +411,7 @@ generator = cpp(context, "DreamGen", blacklist = [ 'namestoold', 'neterror', 'newgame', + 'nextdest', 'nextfolder', 'nextsymbol', 'obicons', @@ -456,6 +459,7 @@ generator = cpp(context, "DreamGen", blacklist = [ 'printslow', 'printsprites', 'printundermon', + 'putbackobstuff', 'putundermenu', 'putundertimed', 'quickquit', @@ -481,6 +485,7 @@ generator = cpp(context, "DreamGen", blacklist = [ 'reconstruct', 'redrawmainscrn', 'reelsonscreen', + 'reexfromopen', 'removeemm', 'removesetobject', 'restoreall', @@ -603,6 +608,7 @@ generator = cpp(context, "DreamGen", blacklist = [ 'usehatch', 'usemenu', 'usemon', + 'useplate', 'userailing', 'useroutine', 'useshield', diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index da525566d4..8b7375302e 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -2422,17 +2422,6 @@ void DreamGenContext::reExFromInv() { data.byte(kPointermode) = 0; } -void DreamGenContext::reExFromOpen() { - STACK_CHECK; - return; - findOpenPos(); - ax = es.word(bx); - data.byte(kCommandtype) = ah; - data.byte(kCommand) = al; - data.byte(kExamagain) = 1; - data.byte(kPointermode) = 0; -} - void DreamGenContext::swapWithInv() { STACK_CHECK; al = data.byte(kItemframe); @@ -4258,109 +4247,6 @@ void DreamGenContext::showArrows() { showFrame(); } -void DreamGenContext::nextDest() { - STACK_CHECK; - _cmp(data.byte(kCommandtype), 218); - if (flags.z()) - goto alreadydu; - data.byte(kCommandtype) = 218; - al = 28; - commandOnly(); -alreadydu: - ax = data.word(kMousebutton); - _and(ax, 1); - if (flags.z()) - return /* (nodu) */; - _cmp(ax, data.word(kOldbutton)); - if (flags.z()) - return /* (nodu) */; -searchdestup: - _inc(data.byte(kDestpos)); - _cmp(data.byte(kDestpos), 15); - if (!flags.z()) - goto notlastdest; - data.byte(kDestpos) = 0; -notlastdest: - getDestInfo(); - _cmp(al, 0); - if (flags.z()) - goto searchdestup; - data.byte(kNewtextline) = 1; - delTextLine(); - delPointer(); - showPanel(); - showMan(); - showArrows(); - locationPic(); - underTextLine(); - readMouse(); - showPointer(); - workToScreen(); - delPointer(); -} - -void DreamGenContext::lastDest() { - STACK_CHECK; - _cmp(data.byte(kCommandtype), 219); - if (flags.z()) - goto alreadydd; - data.byte(kCommandtype) = 219; - al = 29; - commandOnly(); -alreadydd: - ax = data.word(kMousebutton); - _and(ax, 1); - if (flags.z()) - return /* (nodd) */; - _cmp(ax, data.word(kOldbutton)); - if (flags.z()) - return /* (nodd) */; -searchdestdown: - _dec(data.byte(kDestpos)); - _cmp(data.byte(kDestpos), -1); - if (!flags.z()) - goto notfirstdest; - data.byte(kDestpos) = 15; -notfirstdest: - getDestInfo(); - _cmp(al, 0); - if (flags.z()) - goto searchdestdown; - data.byte(kNewtextline) = 1; - delTextLine(); - delPointer(); - showPanel(); - showMan(); - showArrows(); - locationPic(); - underTextLine(); - readMouse(); - showPointer(); - workToScreen(); - delPointer(); -} - -void DreamGenContext::destSelect() { - STACK_CHECK; - _cmp(data.byte(kCommandtype), 222); - if (flags.z()) - goto alreadytrav; - data.byte(kCommandtype) = 222; - al = 30; - commandOnly(); -alreadytrav: - ax = data.word(kMousebutton); - _and(ax, 1); - if (flags.z()) - return /* (notrav) */; - _cmp(ax, data.word(kOldbutton)); - if (flags.z()) - return /* (notrav) */; - getDestInfo(); - al = data.byte(kDestpos); - data.byte(kNewlocation) = al; -} - void DreamGenContext::resetLocation() { STACK_CHECK; push(ax); @@ -6677,23 +6563,6 @@ notfoundinside: goto insideloop; } -void DreamGenContext::putBackObStuff() { - STACK_CHECK; - createPanel(); - showPanel(); - showMan(); - obIcons(); - showExit(); - obPicture(); - describeOb(); - underTextLine(); - data.byte(kCommandtype) = 255; - readMouse(); - showPointer(); - workToScreen(); - delPointer(); -} - void DreamGenContext::showPuzText() { STACK_CHECK; push(cx); @@ -7059,59 +6928,6 @@ donethisbit: putBackObStuff(); } -void DreamGenContext::usePlate() { - STACK_CHECK; - _cmp(data.byte(kWithobject), 255); - if (!flags.z()) - goto platewith; - withWhat(); - return; -platewith: - al = data.byte(kWithobject); - ah = data.byte(kWithtype); - cl = 'S'; - ch = 'C'; - dl = 'R'; - dh = 'W'; - compare(); - if (flags.z()) - goto unscrewplate; - al = data.byte(kWithobject); - ah = data.byte(kWithtype); - cl = 'K'; - ch = 'N'; - dl = 'F'; - dh = 'E'; - compare(); - if (flags.z()) - goto triedknife; - cx = 300; - al = 14; - showPuzText(); - putBackObStuff(); - return; -unscrewplate: - al = 20; - playChannel1(); - showFirstUse(); - al = 28; - placeSetObject(); - al = 24; - placeSetObject(); - al = 25; - removeSetObject(); - al = 0; - placeFreeObject(); - _inc(data.byte(kProgresspoints)); - data.byte(kGetback) = 1; - return; -triedknife: - cx = 300; - al = 54; - showPuzText(); - putBackObStuff(); -} - void DreamGenContext::useWinch() { STACK_CHECK; al = 40; diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 31e7b83b2a..376815b598 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -603,7 +603,6 @@ public: void dumpDiaryKeys(); void disableSoundInt(); void priestText(); - void usePlate(); void lookInInterface(); void loadSpeech(); void adjustLeft(); @@ -691,7 +690,6 @@ public: void lookAtPlace(); void useAxe(); void useElvDoor(); - void putBackObStuff(); void findAllOpen(); void quitSymbol(); void readFromFile(); @@ -700,15 +698,12 @@ public: void useDiary(); void deleteExObject(); void moneyPoke(); - void destSelect(); - void lastDest(); void removeFreeObject(); void lookAtCard(); void helicopter(); void getEitherAd(); void setPickup(); void dropObject(); - void reExFromOpen(); void drawItAll(); void useStereo(); void candles2(); @@ -738,7 +733,6 @@ public: void getDestInfo(); void setupTimedUse(); void grafittiDoor(); - void nextDest(); void makeCaps(); void read(); void additionalText(); diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 108fe2dd5d..6786ba48a7 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -3678,4 +3678,99 @@ void DreamGenContext::errorMessage3() { delPointer(); } +void DreamGenContext::reExFromOpen() { + +} + +void DreamGenContext::nextDest() { + if (data.byte(kCommandtype) != 218) { + data.byte(kCommandtype) = 218; + commandOnly(28); + } + + if ((data.word(kMousebutton) & 1) || (data.word(kMousebutton) == data.word(kOldbutton))) + return; // nodu + + do { + data.byte(kDestpos)++; + if (data.byte(kDestpos) == 15) + data.byte(kDestpos) = 0; // last destination + + getDestInfo(); + } while(al == 0); + + data.byte(kNewtextline) = 1; + delTextLine(); + delPointer(); + showPanel(); + showMan(); + showArrows(); + locationPic(); + underTextLine(); + readMouse(); + showPointer(); + workToScreen(); + delPointer(); +} + +void DreamGenContext::lastDest() { + if (data.byte(kCommandtype) != 219) { + data.byte(kCommandtype) = 219; + commandOnly(29); + } + + if ((data.word(kMousebutton) & 1) || (data.word(kMousebutton) == data.word(kOldbutton))) + return; // nodd + + do { + data.byte(kDestpos)--; + if (data.byte(kDestpos) == 0xFF) + data.byte(kDestpos) = 15; // first destination + + getDestInfo(); + } while(al == 0); + + data.byte(kNewtextline) = 1; + delTextLine(); + delPointer(); + showPanel(); + showMan(); + showArrows(); + locationPic(); + underTextLine(); + readMouse(); + showPointer(); + workToScreen(); + delPointer(); +} + +void DreamGenContext::destSelect() { + if (data.byte(kCommandtype) != 222) { + data.byte(kCommandtype) = 222; + commandOnly(30); + } + + if ((data.word(kMousebutton) & 1) || (data.word(kMousebutton) == data.word(kOldbutton))) + return; // notrav + + getDestInfo(); + data.byte(kNewlocation) = data.byte(kDestpos); +} + +void DreamGenContext::putBackObStuff() { + createPanel(); + showPanel(); + showMan(); + obIcons(); + showExit(); + obPicture(); + describeOb(); + underTextLine(); + data.byte(kCommandtype) = 255; + readMouse(); + showPointer(); + workToScreen(); + delPointer(); +} + } /*namespace dreamgen */ diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index ee503288df..9b79e1ec86 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -400,6 +400,7 @@ void useChurchGate(); void useFullCart(); void useClearBox(); + void usePlate(); void openTVDoor(); void wearWatch(); void wearShades(); @@ -545,5 +546,10 @@ void errorMessage1(); void errorMessage2(); void errorMessage3(); + void reExFromOpen(); + void nextDest(); + void lastDest(); + void destSelect(); + void putBackObStuff(); #endif diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp index d33ad97821..18730eea7e 100644 --- a/engines/dreamweb/use.cpp +++ b/engines/dreamweb/use.cpp @@ -786,4 +786,38 @@ void DreamGenContext::openTVDoor() { } } +void DreamGenContext::usePlate() { + if (data.byte(kWithobject) == 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)) { + // Unscrew plate + playChannel1(20); + showFirstUse(); + placeSetObject(28); + placeSetObject(24); + removeSetObject(25); + al = 0; + placeFreeObject(); + data.byte(kProgresspoints)++; + data.byte(kGetback) = 1; + } else if (compare(data.byte(kWithobject), data.byte(kWithtype), knife)) { + // Tried knife + cx = 300; + al = 54; + showPuzText(); + putBackObStuff(); + } else { + // Wrong item + cx = 300; + al = 14; + showPuzText(); + putBackObStuff(); + } +} + } /*namespace dreamgen */ -- cgit v1.2.3