aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xdevtools/tasmrecover/tasm-recover4
-rw-r--r--devtools/tasmrecover/tasm/cpp.py6
-rw-r--r--engines/dreamweb/dreamgen.cpp132
-rw-r--r--engines/dreamweb/stubs.cpp148
4 files changed, 156 insertions, 134 deletions
diff --git a/devtools/tasmrecover/tasm-recover b/devtools/tasmrecover/tasm-recover
index f550cb0826..278e4465d5 100755
--- a/devtools/tasmrecover/tasm-recover
+++ b/devtools/tasmrecover/tasm-recover
@@ -29,6 +29,7 @@ p.strip_path = 3
context = p.parse('dreamweb/dreamweb.asm')
p.link()
generator = cpp(context, "DreamGen", blacklist = [
+ # These functions are not processed
'randomnumber',
'quickquit',
'quickquit2',
@@ -77,5 +78,8 @@ generator = cpp(context, "DreamGen", blacklist = [
'getroomspaths',
'makebackob',
'facerightway',
+ ], skip_output = [
+ # These functions are processed but not output
+ 'dreamweb'
])
generator.generate('dreamweb') #start routine
diff --git a/devtools/tasmrecover/tasm/cpp.py b/devtools/tasmrecover/tasm/cpp.py
index a73fd6c890..4ed89f650d 100644
--- a/devtools/tasmrecover/tasm/cpp.py
+++ b/devtools/tasmrecover/tasm/cpp.py
@@ -33,7 +33,7 @@ def parse_bin(s):
return v
class cpp:
- def __init__(self, context, namespace, skip_first = 0, blacklist = []):
+ def __init__(self, context, namespace, skip_first = 0, blacklist = [], skip_output = []):
self.namespace = namespace
fname = namespace.lower() + ".cpp"
header = namespace.lower() + ".h"
@@ -79,6 +79,7 @@ class cpp:
self.proc_done = []
self.blacklist = blacklist
self.failed = list(blacklist)
+ self.skip_output = skip_output
self.translated = []
self.proc_addr = []
self.methods = []
@@ -527,7 +528,8 @@ namespace %s {
self.proc.optimize(keep_labels=[label])
self.proc.visit(self, start)
self.body += "}\n";
- self.translated.insert(0, self.body)
+ if name not in self.skip_output:
+ self.translated.insert(0, self.body)
self.proc = None
if self.temps_count > 0:
raise Exception("temps count == %d at the exit of proc" %self.temps_count);
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index 9fa7f16995..fbd7c079e0 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -20062,138 +20062,6 @@ transfer:
dx = 6059;
}
-void DreamGenContext::dreamweb() {
- STACK_CHECK;
- seecommandtail();
- checkbasemem();
- soundstartup();
- setkeyboardint();
- setupemm();
- allocatebuffers();
- setmouse();
- fadedos();
- gettime();
- clearbuffers();
- clearpalette();
- set16colpalette();
- readsetdata();
- data.byte(kWongame) = 0;
- dx = 1909;
- loadsample();
- setsoundoff();
- scanfornames();
- _cmp(al, 0);
- if (!flags.z())
- goto dodecisions;
- setmode();
- loadpalfromiff();
- titles();
- credits();
- goto playgame;
-dodecisions:
- cls();
- setmode();
- decide();
- _cmp(data.byte(kQuitrequested), 0);
- if (!flags.z())
- return /* (exitgame) */;
- _cmp(data.byte(kGetback), 4);
- if (flags.z())
- goto mainloop;
- titles();
- _cmp(data.byte(kQuitrequested), 0);
- if (!flags.z())
- return /* (exitgame) */;
- credits();
-playgame:
- _cmp(data.byte(kQuitrequested), 0);
- if (!flags.z())
- return /* (exitgame) */;
- clearchanges();
- setmode();
- loadpalfromiff();
- data.byte(kLocation) = 255;
- data.byte(kRoomafterdream) = 1;
- data.byte(kNewlocation) = 35;
- data.byte(kVolume) = 7;
- loadroom();
- clearsprites();
- initman();
- entrytexts();
- entryanims();
- data.byte(kDestpos) = 3;
- initialinv();
- data.byte(kLastflag) = 32;
- startup1();
- data.byte(kVolumeto) = 0;
- data.byte(kVolumedirection) = -1;
- data.byte(kCommandtype) = 255;
- goto mainloop;
-loadnew:
- clearbeforeload();
- loadroom();
- clearsprites();
- initman();
- entrytexts();
- entryanims();
- data.byte(kNewlocation) = 255;
- startup();
- data.byte(kCommandtype) = 255;
- worktoscreenm();
- goto mainloop;
- data.byte(kNewlocation) = 255;
- clearsprites();
- initman();
- startup();
- data.byte(kCommandtype) = 255;
-mainloop:
- _cmp(data.byte(kQuitrequested), 0);
- if (!flags.z())
- return /* (exitgame) */;
- screenupdate();
- _cmp(data.byte(kWongame), 0);
- if (!flags.z())
- goto endofgame;
- _cmp(data.byte(kMandead), 1);
- if (flags.z())
- goto gameover;
- _cmp(data.byte(kMandead), 2);
- if (flags.z())
- goto gameover;
- _cmp(data.word(kWatchingtime), 0);
- if (flags.z())
- goto notwatching;
- al = data.byte(kFinaldest);
- _cmp(al, data.byte(kManspath));
- if (!flags.z())
- goto mainloop;
- _dec(data.word(kWatchingtime));
- if (!flags.z())
- goto mainloop;
-notwatching:
- _cmp(data.byte(kMandead), 4);
- if (flags.z())
- goto gameover;
- _cmp(data.byte(kNewlocation), 255);
- if (!flags.z())
- goto loadnew;
- goto mainloop;
-gameover:
- clearbeforeload();
- showgun();
- fadescreendown();
- cx = 100;
- hangon();
- goto dodecisions;
-endofgame:
- clearbeforeload();
- fadescreendowns();
- cx = 200;
- hangon();
- endgame();
- { quickquit2(); return; };
-}
-
void DreamGenContext::__start() {
diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index 688ad82d92..3aebe02a43 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -26,6 +26,154 @@
namespace DreamGen {
+void DreamGenContext::dreamweb() {
+ STACK_CHECK;
+ seecommandtail();
+ checkbasemem();
+ soundstartup();
+ setkeyboardint();
+ setupemm();
+ allocatebuffers();
+ setmouse();
+ fadedos();
+ gettime();
+ clearbuffers();
+ clearpalette();
+ set16colpalette();
+ readsetdata();
+ data.byte(kWongame) = 0;
+
+ dx = 1909;
+ loadsample();
+ setsoundoff();
+
+ bool firstLoop = true;
+
+ while (true) {
+
+ scanfornames();
+
+ bool startNewGame = true;
+
+ if (al == 0 && firstLoop) {
+
+ // no savegames found, and we're not restarting.
+
+ setmode();
+ loadpalfromiff();
+
+ } else {
+ // "dodecisions"
+
+ // Savegames found, so ask if we should load one.
+ // (If we're restarting after game over, we also always show these
+ // options.)
+
+ cls();
+ setmode();
+ decide();
+ if (data.byte(kQuitrequested))
+ return; // exit game
+
+ if (data.byte(kGetback) == 4)
+ startNewGame = false; // savegame has been loaded
+
+ }
+
+ firstLoop = false;
+
+ if (startNewGame) {
+ // "playgame"
+
+ titles();
+ if (data.byte(kQuitrequested))
+ return; // exit game
+ credits();
+
+ if (data.byte(kQuitrequested))
+ return; // exit game
+
+ clearchanges();
+ setmode();
+ loadpalfromiff();
+ data.byte(kLocation) = 255;
+ data.byte(kRoomafterdream) = 1;
+ data.byte(kNewlocation) = 35;
+ data.byte(kVolume) = 7;
+ loadroom();
+ clearsprites();
+ initman();
+ entrytexts();
+ entryanims();
+ data.byte(kDestpos) = 3;
+ initialinv();
+ data.byte(kLastflag) = 32;
+ startup1();
+ data.byte(kVolumeto) = 0;
+ data.byte(kVolumedirection) = -1;
+ data.byte(kCommandtype) = 255;
+
+ }
+
+ // main loop
+ while (true) {
+
+ if (data.byte(kQuitrequested))
+ return; // exit game
+
+ screenupdate();
+
+ if (data.byte(kWongame) != 0) {
+ // "endofgame"
+ clearbeforeload();
+ fadescreendowns();
+ cx = 200;
+ hangon();
+ endgame();
+ quickquit2();
+ return;
+ }
+
+ if (data.byte(kMandead) == 1 || data.byte(kMandead) == 2)
+ break;
+
+ if (data.word(kWatchingtime) > 0) {
+ if (data.byte(kFinaldest) == data.byte(kManspath))
+ data.word(kWatchingtime)--;
+ }
+
+ if (data.word(kWatchingtime) == 0) {
+ // "notwatching"
+
+ if (data.byte(kMandead) == 4)
+ break;
+
+ if (data.byte(kNewlocation) != 255) {
+ // "loadnew"
+ clearbeforeload();
+ loadroom();
+ clearsprites();
+ initman();
+ entrytexts();
+ entryanims();
+ data.byte(kNewlocation) = 255;
+ startup();
+ data.byte(kCommandtype) = 255;
+ worktoscreenm();
+ }
+ }
+ }
+
+ // "gameover"
+ clearbeforeload();
+ showgun();
+ fadescreendown();
+ cx = 100;
+ hangon();
+
+ }
+}
+
Common::String getFilename(Context &context) {
uint16 name_ptr = context.dx;
Common::String name;