aboutsummaryrefslogtreecommitdiff
path: root/engines/dreamweb
diff options
context:
space:
mode:
authorBertrand Augereau2011-09-03 14:24:44 +0200
committerBertrand Augereau2011-09-03 14:41:44 +0200
commit4782c7e34e83cdef57c613c08bb313ea4c6fbd24 (patch)
tree430569733828f95016701f082a6075441e5c3896 /engines/dreamweb
parent49d1872876d9f26f8a30fa81056a6adea5cb30d2 (diff)
downloadscummvm-rg350-4782c7e34e83cdef57c613c08bb313ea4c6fbd24.tar.gz
scummvm-rg350-4782c7e34e83cdef57c613c08bb313ea4c6fbd24.tar.bz2
scummvm-rg350-4782c7e34e83cdef57c613c08bb313ea4c6fbd24.zip
DREAMWEB: Introduction of a Path structure
Diffstat (limited to 'engines/dreamweb')
-rw-r--r--engines/dreamweb/pathfind.cpp40
-rw-r--r--engines/dreamweb/sprite.cpp4
-rw-r--r--engines/dreamweb/structs.h10
-rw-r--r--engines/dreamweb/stubs.h4
4 files changed, 34 insertions, 24 deletions
diff --git a/engines/dreamweb/pathfind.cpp b/engines/dreamweb/pathfind.cpp
index f7fbb854bc..873fe794cb 100644
--- a/engines/dreamweb/pathfind.cpp
+++ b/engines/dreamweb/pathfind.cpp
@@ -33,10 +33,10 @@ void DreamGenContext::turnpathon() {
void DreamGenContext::turnpathon(uint8 param) {
findormake(param, 0xff, data.byte(kRoomnum) + 100);
- uint8 *roomsPaths = getroomspathsCPP();
+ Path *roomsPaths = getroomspathsCPP();
if (param == 0xff)
return;
- roomsPaths[8 * param + 6] = 0xff;
+ roomsPaths[param].b6 = 0xff;
}
void DreamGenContext::turnpathoff() {
@@ -45,16 +45,16 @@ void DreamGenContext::turnpathoff() {
void DreamGenContext::turnpathoff(uint8 param) {
findormake(param, 0x00, data.byte(kRoomnum) + 100);
- uint8 *roomsPaths = getroomspathsCPP();
+ Path *roomsPaths = getroomspathsCPP();
if (param == 0xff)
return;
- roomsPaths[8 * param + 6] = 0x00;
+ roomsPaths[param].b6 = 0x00;
}
void DreamGenContext::turnanypathon(uint8 param, uint8 room) {
findormake(param, 0xff, room + 100);
- uint8 *paths = segRef(data.word(kReels)).ptr(kPathdata + 144 * room, 0);
- paths[8 * param + 6] = 0xff;
+ Path *paths = (Path *)segRef(data.word(kReels)).ptr(kPathdata + 144 * room, 0);
+ paths[param].b6 = 0xff;
}
@@ -64,8 +64,8 @@ void DreamGenContext::turnanypathon() {
void DreamGenContext::turnanypathoff(uint8 param, uint8 room) {
findormake(param, 0x00, room + 100);
- uint8 *paths = segRef(data.word(kReels)).ptr(kPathdata + 144 * room, 0);
- paths[8 * param + 6] = 0x00;
+ Path *paths = (Path *)segRef(data.word(kReels)).ptr(kPathdata + 144 * room, 0);
+ paths[param].b6 = 0x00;
}
void DreamGenContext::turnanypathoff() {
@@ -77,21 +77,21 @@ void DreamGenContext::getroomspaths() {
bx = data.byte(kRoomnum) * 144;
}
-uint8 *DreamGenContext::getroomspathsCPP() {
+Path *DreamGenContext::getroomspathsCPP() {
void *result = segRef(data.word(kReels)).ptr(data.byte(kRoomnum) * 144, 144);
- return (uint8 *)result;
+ return (Path *)result;
}
void DreamGenContext::autosetwalk() {
al = data.byte(kManspath);
if (data.byte(kFinaldest) == al)
return;
- const uint8 *roomsPaths = getroomspathsCPP();
+ const Path *roomsPaths = getroomspathsCPP();
checkdest(roomsPaths);
- data.word(kLinestartx) = roomsPaths[data.byte(kManspath) * 8 + 0] - 12;
- data.word(kLinestarty) = roomsPaths[data.byte(kManspath) * 8 + 1] - 12;
- data.word(kLineendx) = roomsPaths[data.byte(kDestination) * 8 + 0] - 12;
- data.word(kLineendy) = roomsPaths[data.byte(kDestination) * 8 + 1] - 12;
+ data.word(kLinestartx) = roomsPaths[data.byte(kManspath)].x - 12;
+ data.word(kLinestarty) = roomsPaths[data.byte(kManspath)].y - 12;
+ data.word(kLineendx) = roomsPaths[data.byte(kDestination)].x - 12;
+ data.word(kLineendy) = roomsPaths[data.byte(kDestination)].y - 12;
bresenhams();
if (data.byte(kLinedirection) != 0) {
data.byte(kLinepointer) = data.byte(kLinelength) - 1;
@@ -101,8 +101,8 @@ void DreamGenContext::autosetwalk() {
data.byte(kLinepointer) = 0;
}
-void DreamGenContext::checkdest(const uint8 *roomsPaths) {
- const uint8 *p = roomsPaths + 12 * 8;
+void DreamGenContext::checkdest(const Path *roomsPaths) {
+ const uint8 *p = (const uint8 *)roomsPaths + 12 * 8;
ah = data.byte(kManspath) << 4;
al = data.byte(kDestination);
uint8 destination = data.byte(kDestination);
@@ -124,9 +124,9 @@ void DreamGenContext::checkdest(const uint8 *roomsPaths) {
}
void DreamGenContext::findxyfrompath() {
- const uint8 *roomsPaths = getroomspathsCPP();
- data.byte(kRyanx) = roomsPaths[data.byte(kManspath) * 8 + 0] - 12;
- data.byte(kRyany) = roomsPaths[data.byte(kManspath) * 8 + 1] - 12;
+ const Path *roomsPaths = getroomspathsCPP();
+ data.byte(kRyanx) = roomsPaths[data.byte(kManspath)].x - 12;
+ data.byte(kRyany) = roomsPaths[data.byte(kManspath)].y - 12;
}
} /*namespace dreamgen */
diff --git a/engines/dreamweb/sprite.cpp b/engines/dreamweb/sprite.cpp
index 13db909dbe..8de829ae05 100644
--- a/engines/dreamweb/sprite.cpp
+++ b/engines/dreamweb/sprite.cpp
@@ -501,8 +501,8 @@ void DreamGenContext::liftsprite(Sprite *sprite, SetObject *objData) {
}
void DreamGenContext::facerightway() {
- uint8 *paths = getroomspathsCPP();
- uint8 dir = paths[8 * data.byte(kManspath) + 7];
+ Path *paths = getroomspathsCPP();
+ uint8 dir = paths[data.byte(kManspath)].b7;
data.byte(kTurntoface) = dir;
data.byte(kLeavedirection) = dir;
}
diff --git a/engines/dreamweb/structs.h b/engines/dreamweb/structs.h
index 07419459a6..c0d5636538 100644
--- a/engines/dreamweb/structs.h
+++ b/engines/dreamweb/structs.h
@@ -228,4 +228,14 @@ struct Change {
uint8 type;
};
+struct Path {
+ uint8 x;
+ uint8 y;
+ uint8 b2;
+ uint8 b3;
+ uint8 b4;
+ uint8 b5;
+ uint8 b6;
+ uint8 b7;
+};
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h
index 8244e5e218..2602f11a9c 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -84,7 +84,7 @@
void facerightway();
void walking(Sprite *sprite);
void autosetwalk();
- void checkdest(const uint8 *roomsPaths);
+ void checkdest(const Path *roomsPaths);
void aboutturn(Sprite *sprite);
void backobject(Sprite *sprite);
void constant(Sprite *sprite, SetObject *objData);
@@ -112,7 +112,7 @@
void turnanypathon();
void turnanypathoff();
void getroomspaths();
- uint8 *getroomspathsCPP();
+ Path *getroomspathsCPP();
void makebackob(SetObject *objData);
void modifychar();
void lockmon();