aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBertrand Augereau2011-12-01 16:21:16 +0100
committerBertrand Augereau2011-12-01 18:33:05 +0100
commit24c355e04fe7fb536bbfd72bdb998b4dbf265148 (patch)
tree5b5257cbf2ef631c2d345a77e1792dc479468e2d
parentba12c02a7513f31e20c126baa9562764bcc6cc4b (diff)
downloadscummvm-rg350-24c355e04fe7fb536bbfd72bdb998b4dbf265148.tar.gz
scummvm-rg350-24c355e04fe7fb536bbfd72bdb998b4dbf265148.tar.bz2
scummvm-rg350-24c355e04fe7fb536bbfd72bdb998b4dbf265148.zip
DREAMWEB: Ported 'sparky' to C++
-rwxr-xr-xdevtools/tasmrecover/tasm-recover1
-rw-r--r--engines/dreamweb/dreamgen.cpp38
-rw-r--r--engines/dreamweb/dreamgen.h2
-rw-r--r--engines/dreamweb/sprite.cpp26
-rw-r--r--engines/dreamweb/structs.h1
-rw-r--r--engines/dreamweb/stubs.h1
6 files changed, 27 insertions, 42 deletions
diff --git a/devtools/tasmrecover/tasm-recover b/devtools/tasmrecover/tasm-recover
index e36c3df6cb..b0cd1e916d 100755
--- a/devtools/tasmrecover/tasm-recover
+++ b/devtools/tasmrecover/tasm-recover
@@ -340,6 +340,7 @@ generator = cpp(context, "DreamGen", blacklist = [
'barwoman',
'gamer',
'eden',
+ 'sparky',
], skip_output = [
# These functions are processed but not output
'dreamweb',
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index cfdfcd47a4..f0d471e329 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -1742,44 +1742,6 @@ nocopper:
addtopeoplelist();
}
-void DreamGenContext::sparky() {
- STACK_CHECK;
- _cmp(data.word(kCard1money), 0);
- if (flags.z())
- goto animsparky;
- es.byte(bx+7) = 3;
- goto animsparky;
-animsparky:
- checkspeed();
- if (!flags.z())
- goto finishsparky;
- _cmp(es.word(bx+3), 34);
- if (!flags.z())
- goto notsparky1;
- randomnumber();
- _cmp(al, 30);
- if (flags.c())
- goto dosparky;
- es.word(bx+3) = 27;
- goto finishsparky;
-notsparky1:
- _cmp(es.word(bx+3), 48);
- if (!flags.z())
- goto dosparky;
- es.word(bx+3) = 27;
- goto finishsparky;
-dosparky:
- _inc(es.word(bx+3));
-finishsparky:
- showgamereel();
- addtopeoplelist();
- al = es.byte(bx+7);
- _and(al, 128);
- if (flags.z())
- return /* (nottalkedsparky) */;
- data.byte(kTalkedtosparky) = 1;
-}
-
void DreamGenContext::train() {
STACK_CHECK;
return;
diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h
index d6d2a16709..78c4e5c58a 100644
--- a/engines/dreamweb/dreamgen.h
+++ b/engines/dreamweb/dreamgen.h
@@ -429,7 +429,6 @@ public:
static const uint16 addr_checkforexit = 0xc148;
static const uint16 addr_mainman = 0xc138;
static const uint16 addr_train = 0xc104;
- static const uint16 addr_sparky = 0xc100;
static const uint16 addr_copper = 0xc0fc;
static const uint16 addr_advisor = 0xc0f8;
static const uint16 addr_drunk = 0xc0f4;
@@ -1309,7 +1308,6 @@ public:
void showmonk();
void diarykeyn();
void set16colpalette();
- void sparky();
void interviewer();
void purgeanitem();
void madman();
diff --git a/engines/dreamweb/sprite.cpp b/engines/dreamweb/sprite.cpp
index a9f5bf1815..76f1dd34dd 100644
--- a/engines/dreamweb/sprite.cpp
+++ b/engines/dreamweb/sprite.cpp
@@ -570,7 +570,7 @@ void DreamGenContext::showrain() {
static void (DreamGenContext::*reelCallbacks[57])() = {
NULL, NULL,
NULL, &DreamGenContext::edeninbath,
- &DreamGenContext::sparky, &DreamGenContext::smokebloke,
+ NULL, &DreamGenContext::smokebloke,
&DreamGenContext::manasleep, &DreamGenContext::drunk,
&DreamGenContext::receptionist, &DreamGenContext::malefan,
&DreamGenContext::femalefan, &DreamGenContext::louis,
@@ -602,7 +602,7 @@ static void (DreamGenContext::*reelCallbacks[57])() = {
static void (DreamGenContext::*reelCallbacksCPP[57])(ReelRoutine &) = {
&DreamGenContext::gamer, &DreamGenContext::sparkydrip,
&DreamGenContext::eden, /*&DreamGenContext::edeninbath*/NULL,
- /*&DreamGenContext::sparky*/NULL, /*&DreamGenContext::smokebloke*/NULL,
+ &DreamGenContext::sparky, /*&DreamGenContext::smokebloke*/NULL,
/*&DreamGenContext::manasleep*/NULL, /*&DreamGenContext::drunk*/NULL,
/*&DreamGenContext::receptionist*/NULL, /*&DreamGenContext::malefan*/NULL,
/*&DreamGenContext::femalefan*/NULL, /*&DreamGenContext::louis*/NULL,
@@ -1107,5 +1107,27 @@ void DreamGenContext::eden(ReelRoutine &routine) {
addtopeoplelist(&routine);
}
+void DreamGenContext::sparky(ReelRoutine &routine) {
+ if (data.word(kCard1money))
+ routine.b7 = 3;
+ if (checkspeed(&routine)) {
+ if (routine.reelPointer() != 34) {
+ if (engine->randomNumber() < 30)
+ routine.incReelPointer();
+ else
+ routine.setReelPointer(27);
+ } else {
+ if (routine.reelPointer() != 48)
+ routine.incReelPointer();
+ else
+ routine.setReelPointer(27);
+ }
+ }
+ showgamereel(&routine);
+ addtopeoplelist(&routine);
+ if (routine.b7 & 128)
+ data.byte(kTalkedtosparky) = 1;
+}
+
} /*namespace dreamgen */
diff --git a/engines/dreamweb/structs.h b/engines/dreamweb/structs.h
index db863ac226..62f4be6a5c 100644
--- a/engines/dreamweb/structs.h
+++ b/engines/dreamweb/structs.h
@@ -167,6 +167,7 @@ struct ReelRoutine {
uint8 b4;
uint16 reelPointer() const { return READ_LE_UINT16(&b3); }
void setReelPointer(uint16 v) { WRITE_LE_UINT16(&b3, v); }
+ void incReelPointer() { setReelPointer(reelPointer() + 1); }
uint8 period;
uint8 counter;
uint8 b7;
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h
index 68349dbfad..974b61dc00 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -381,4 +381,5 @@
void othersmoker(ReelRoutine &routine);
void gamer(ReelRoutine &routine);
void eden(ReelRoutine &routine);
+ void sparky(ReelRoutine &routine);