[Scummvm-cvs-logs] scummvm master -> 4782c7e34e83cdef57c613c08bb313ea4c6fbd24

tramboi bertrand_augereau at yahoo.fr
Sat Sep 3 12:45:38 CEST 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:
4782c7e34e DREAMWEB: Introduction of a Path structure


Commit: 4782c7e34e83cdef57c613c08bb313ea4c6fbd24
    https://github.com/scummvm/scummvm/commit/4782c7e34e83cdef57c613c08bb313ea4c6fbd24
Author: Bertrand Augereau (bertrand_augereau at yahoo.fr)
Date: 2011-09-03T05:41:44-07:00

Commit Message:
DREAMWEB: Introduction of a Path structure

Changed paths:
    engines/dreamweb/pathfind.cpp
    engines/dreamweb/sprite.cpp
    engines/dreamweb/structs.h
    engines/dreamweb/stubs.h



diff --git a/engines/dreamweb/pathfind.cpp b/engines/dreamweb/pathfind.cpp
index f7fbb85..873fe79 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 13db909..8de829a 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 0741945..c0d5636 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 8244e5e..2602f11 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();






More information about the Scummvm-git-logs mailing list