[Scummvm-cvs-logs] scummvm master -> 7945a0fbb0ee3ec89d2b4e51d130f47b9717bfd3
bluegr
md5 at scummvm.org
Mon Dec 26 01:51:13 CET 2011
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
7945a0fbb0 DREAMWEB: Cleaned up findFirstPath(), fixed a regression and moved it to DreamBase
Commit: 7945a0fbb0ee3ec89d2b4e51d130f47b9717bfd3
https://github.com/scummvm/scummvm/commit/7945a0fbb0ee3ec89d2b4e51d130f47b9717bfd3
Author: Filippos Karapetis (md5 at scummvm.org)
Date: 2011-12-25T16:50:02-08:00
Commit Message:
DREAMWEB: Cleaned up findFirstPath(), fixed a regression and moved it to DreamBase
Changed paths:
engines/dreamweb/dreambase.h
engines/dreamweb/object.cpp
engines/dreamweb/pathfind.cpp
engines/dreamweb/structs.h
engines/dreamweb/stubs.h
diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h
index 0dc4e52..a7b3316 100644
--- a/engines/dreamweb/dreambase.h
+++ b/engines/dreamweb/dreambase.h
@@ -220,6 +220,7 @@ public:
bool checkIfPathIsOn(uint8 index);
void bresenhams();
void workoutFrames();
+ byte findFirstPath(byte x, byte y);
// from people.cpp
void setupInitialReelRoutines();
diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp
index 84829bf..8e202a0 100644
--- a/engines/dreamweb/object.cpp
+++ b/engines/dreamweb/object.cpp
@@ -341,32 +341,6 @@ void DreamGenContext::openOb() {
_openChangeSize = getOpenedSlotCount() * kItempicsize + kInventx;
}
-uint8 DreamGenContext::findFirstPath(uint16 param) {
- es = data.word(kReels);
- uint16 ptr = 144 * data.byte(kRoomnum);
- // TODO: Replace ax, cx usage with temporary uint8/16 variables...
- cx = param;
-
- for (uint8 pathLoop = 0; pathLoop < 12; pathLoop++, ptr += 8) {
- ax = es.word(ptr+2);
-
- if (ax == 0x0ffff)
- continue; // "nofirst"
-
- if (cl < al || ch < ah)
- continue; // "nofirst"
-
- ax = es.word(ptr+4);
-
- if (cl > al || ch > ah)
- continue; // "nofirst"
-
- return es.byte(ptr+6); // "gotfirst"
- }
-
- return 0;
-}
-
void DreamGenContext::identifyOb() {
if (data.word(kWatchingtime) != 0) {
blank();
@@ -388,7 +362,7 @@ void DreamGenContext::identifyOb() {
data.byte(kPointerspath) = dl;
ax = pop();
push(ax);
- data.byte(kPointerfirstpath) = findFirstPath(ax);
+ data.byte(kPointerfirstpath) = findFirstPath(al, ah);
ax = pop();
byte x = al;
diff --git a/engines/dreamweb/pathfind.cpp b/engines/dreamweb/pathfind.cpp
index 8d9d9a9..20bbf7d 100644
--- a/engines/dreamweb/pathfind.cpp
+++ b/engines/dreamweb/pathfind.cpp
@@ -309,4 +309,24 @@ void DreamBase::workoutFrames() {
data.byte(kTurndirection) = 0;
}
+byte DreamBase::findFirstPath(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].x1 == 0xff && paths[index].y1 == 0xff)
+ continue; // "nofirst"
+
+ if (x < paths[index].x1 || y < paths[index].y1)
+ continue; // "nofirst"
+
+ if (x >= paths[index].x2 || y >= paths[index].y2)
+ continue; // "nofirst"
+
+ return paths[index].on; // "gotfirst"
+ }
+
+ return 0;
+}
+
+
} // End of namespace DreamGen
diff --git a/engines/dreamweb/structs.h b/engines/dreamweb/structs.h
index d64bcab..b0a1689 100644
--- a/engines/dreamweb/structs.h
+++ b/engines/dreamweb/structs.h
@@ -221,10 +221,10 @@ struct Change {
struct PathNode {
uint8 x;
uint8 y;
- uint8 b2;
- uint8 b3;
- uint8 b4;
- uint8 b5;
+ uint8 x1;
+ uint8 y1;
+ uint8 x2;
+ uint8 y2;
uint8 on;
uint8 dir;
};
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h
index 62259a1..148436e 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -172,7 +172,6 @@
void checkObjectSize();
bool checkObjectSizeCPP();
void openOb();
- uint8 findFirstPath(uint16 param);
void identifyOb();
void selectOb();
void findInvPos();
More information about the Scummvm-git-logs
mailing list