diff --git a/devtools/tasmrecover/tasm-recover b/devtools/tasmrecover/tasm-recover index e36c3df6cb9..b0cd1e916d8 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 cfdfcd47a4c..f0d471e329d 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 d6d2a167094..78c4e5c58ac 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 a9f5bf1815b..76f1dd34dd9 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 db863ac2268..62f4be6a5c3 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 68349dbfada..974b61dc007 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);