aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xdevtools/tasmrecover/tasm-recover1
-rw-r--r--engines/dreamweb/dreambase.h1
-rw-r--r--engines/dreamweb/dreamgen.cpp44
-rw-r--r--engines/dreamweb/dreamgen.h1
-rw-r--r--engines/dreamweb/object.cpp3
-rw-r--r--engines/dreamweb/pathfind.cpp21
-rw-r--r--engines/dreamweb/stubs.cpp5
7 files changed, 25 insertions, 51 deletions
diff --git a/devtools/tasmrecover/tasm-recover b/devtools/tasmrecover/tasm-recover
index 61d5a81c1a..a076c9e463 100755
--- a/devtools/tasmrecover/tasm-recover
+++ b/devtools/tasmrecover/tasm-recover
@@ -454,6 +454,7 @@ generator = cpp(context, "DreamGen", blacklist = [
'findobname',
'findopenpos',
'findormake',
+ 'findpathofpoint',
'findpuztext',
'findroominloc',
'findsetobject',
diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h
index a669e6bc20..cbcfa1e46f 100644
--- a/engines/dreamweb/dreambase.h
+++ b/engines/dreamweb/dreambase.h
@@ -221,6 +221,7 @@ public:
void bresenhams();
void workoutFrames();
byte findFirstPath(byte x, byte y);
+ byte findPathOfPoint(byte x, byte y);
// from people.cpp
void setupInitialReelRoutines();
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index fcf8dc6727..6c16274e32 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -652,50 +652,6 @@ finishpars:
di = offset_operand1;
}
-void DreamGenContext::findPathOfPoint() {
- STACK_CHECK;
- push(ax);
- bx = (0);
- es = data.word(kReels);
- al = data.byte(kRoomnum);
- ah = 0;
- cx = 144;
- _mul(cx);
- _add(bx, ax);
- cx = pop();
- dl = 0;
-pathloop:
- al = es.byte(bx+6);
- _cmp(al, 255);
- if (!flags.z())
- goto flunkedit;
- ax = es.word(bx+2);
- _cmp(ax, 0x0ffff);
- if (flags.z())
- goto flunkedit;
- _cmp(cl, al);
- if (flags.c())
- goto flunkedit;
- _cmp(ch, ah);
- if (flags.c())
- goto flunkedit;
- ax = es.word(bx+4);
- _cmp(cl, al);
- if (!flags.c())
- goto flunkedit;
- _cmp(ch, ah);
- if (!flags.c())
- goto flunkedit;
- return /* (gotvalidpath) */;
-flunkedit:
- _add(bx, 8);
- _inc(dl);
- _cmp(dl, 12);
- if (!flags.z())
- goto pathloop;
- dl = 255;
-}
-
void DreamGenContext::__start() {
static const uint8 src[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x13, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h
index 40046c4379..6c5bf1918b 100644
--- a/engines/dreamweb/dreamgen.h
+++ b/engines/dreamweb/dreamgen.h
@@ -463,7 +463,6 @@ public:
void findAllOpen();
void fillOpen();
void dreamweb();
- void findPathOfPoint();
void read();
void searchForString();
void searchForFiles();
diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp
index 7864b2aa25..9d5ea15fa3 100644
--- a/engines/dreamweb/object.cpp
+++ b/engines/dreamweb/object.cpp
@@ -354,8 +354,7 @@ void DreamGenContext::identifyOb() {
data.byte(kInmaparea) = 1;
ah = bl;
push(ax);
- findPathOfPoint();
- data.byte(kPointerspath) = dl;
+ data.byte(kPointerspath) = findPathOfPoint(al, ah);
ax = pop();
push(ax);
data.byte(kPointerfirstpath) = findFirstPath(al, ah);
diff --git a/engines/dreamweb/pathfind.cpp b/engines/dreamweb/pathfind.cpp
index 20bbf7d67e..4f887db251 100644
--- a/engines/dreamweb/pathfind.cpp
+++ b/engines/dreamweb/pathfind.cpp
@@ -328,5 +328,26 @@ byte DreamBase::findFirstPath(byte x, byte y) {
return 0;
}
+byte DreamBase::findPathOfPoint(byte x, byte y) {
+ PathNode *paths = (PathNode *)getSegment(data.word(kReels)).ptr(kPathdata + 144 * data.byte(kRoomnum), 0);
+
+ for (uint8 index = 0; index < 12; index++) {
+ if (paths[index].on != 0xff)
+ continue; // "flunkedit"
+
+ if (paths[index].x1 == 0xff && paths[index].y1 == 0xff)
+ continue; // "flunkedit"
+
+ if (x < paths[index].x1 || y < paths[index].y1)
+ continue; // "flunkedit"
+
+ if (x >= paths[index].x2 || y >= paths[index].y2)
+ continue; // "flunkedit"
+
+ return index; // "gotvalidpath"
+ }
+
+ return 0xff;
+}
} // End of namespace DreamGen
diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index e8fa1767b8..413bd27c85 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -3067,10 +3067,7 @@ void DreamGenContext::afterNewRoom() {
data.byte(kCommandtype) = 0;
findRoomInLoc();
if (data.byte(kRyanon) != 1) {
- al = data.byte(kRyanx) + 12;
- ah = data.byte(kRyany) + 12;
- findPathOfPoint();
- data.byte(kManspath) = dl;
+ data.byte(kManspath) = findPathOfPoint(data.byte(kRyanx) + 12, data.byte(kRyany) + 12);
findXYFromPath();
data.byte(kResetmanxy) = 1;
}