Skip to content

Commit

Permalink
DREAMWEB: Port 'usewire' to C++
Browse files Browse the repository at this point in the history
  • Loading branch information
bluegr committed Dec 12, 2011
1 parent 0ade224 commit 903ce79
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 51 deletions.
1 change: 1 addition & 0 deletions devtools/tasmrecover/tasm-recover
Expand Up @@ -806,6 +806,7 @@ generator = cpp(context, "DreamGen", blacklist = [
'usewall',
'usewinch',
'usewindow',
'usewire',
'viewfolder',
'vsync',
'volumeadjust',
Expand Down
49 changes: 0 additions & 49 deletions engines/dreamweb/dreamgen.cpp
Expand Up @@ -4135,55 +4135,6 @@ void DreamGenContext::useControl() {
putBackObStuff();
}

void DreamGenContext::useWire() {
STACK_CHECK;
_cmp(data.byte(kWithobject), 255);
if (!flags.z())
goto gotwirewith;
withWhat();
return;
gotwirewith:
al = data.byte(kWithobject);
ah = data.byte(kWithtype);
cl = 'K';
ch = 'N';
dl = 'F';
dh = 'E';
compare();
if (flags.z())
goto wireknife;
al = data.byte(kWithobject);
ah = data.byte(kWithtype);
cl = 'A';
ch = 'X';
dl = 'E';
dh = 'D';
compare();
if (flags.z())
goto wireaxe;
cx = 300;
al = 14;
showPuzText();
putBackObStuff();
return;
wireaxe:
cx = 300;
al = 16;
showPuzText();
putBackObStuff();
return;
wireknife:
al = 51;
removeSetObject();
al = 52;
placeSetObject();
cx = 300;
al = 11;
showPuzText();
_inc(data.byte(kProgresspoints));
data.byte(kGetback) = 1;
}

void DreamGenContext::useHandle() {
STACK_CHECK;
al = 'C';
Expand Down
3 changes: 1 addition & 2 deletions engines/dreamweb/dreamgen.h
Expand Up @@ -486,13 +486,11 @@ class DreamGenContext : public DreamBase, public Context {
void __start();
#include "stubs.h" // Allow hand-reversed functions to have a signature different than void f()

void useWire();
void identifyOb();
void runEndSeq();
void useOpenBox();
void clearBuffers();
void getObTextStart();
void dumpDiaryKeys();
void entryTexts();
void putUnderCentre();
void checkObjectSize();
Expand All @@ -519,6 +517,7 @@ class DreamGenContext : public DreamBase, public Context {
void usePipe();
void reminders();
void runTap();
void dumpDiaryKeys();
void checkForExit();
void lookInInterface();
void inToInv();
Expand Down
1 change: 1 addition & 0 deletions engines/dreamweb/stubs.h
Expand Up @@ -348,6 +348,7 @@
void useCardReader3();
void usePoolReader();
void useCooker();
void useWire();
bool defaultUseHandler(const char *id);
void openTVDoor();
void wearWatch();
Expand Down
27 changes: 27 additions & 0 deletions engines/dreamweb/use.cpp
Expand Up @@ -1110,6 +1110,33 @@ void DreamGenContext::useLighter() {
}
}

void DreamGenContext::useWire() {
if (data.byte(kWithobject) == 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)) {
removeSetObject(51);
placeSetObject(52);
showPuzText(11, 300);
data.byte(kProgresspoints)++;
data.byte(kGetback) = 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)) {
showPuzText(16, 300);
putBackObStuff();
return;
}

showPuzText(14, 300);
putBackObStuff();
}

void DreamGenContext::openTomb() {
data.byte(kProgresspoints)++;
showFirstUse();
Expand Down

0 comments on commit 903ce79

Please sign in to comment.