[Scummvm-cvs-logs] SF.net SVN: scummvm: [22205] scummvm/trunk/engines/lure

dreammaster at users.sourceforge.net dreammaster at users.sourceforge.net
Sat Apr 29 04:16:02 CEST 2006


Revision: 22205
Author:   dreammaster
Date:     2006-04-29 04:15:03 -0700 (Sat, 29 Apr 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=22205&view=rev

Log Message:
-----------
Reworked resources to handle moved hotspot proximity (walk to) co-ordinates

Modified Paths:
--------------
    scummvm/trunk/engines/lure/res_struct.cpp
    scummvm/trunk/engines/lure/res_struct.h
Modified: scummvm/trunk/engines/lure/res_struct.cpp
===================================================================
--- scummvm/trunk/engines/lure/res_struct.cpp	2006-04-29 11:13:47 UTC (rev 22204)
+++ scummvm/trunk/engines/lure/res_struct.cpp	2006-04-29 11:15:03 UTC (rev 22205)
@@ -118,10 +118,9 @@
 }
 
 void RoomPathsData::setOccupied(int x, int y, int width) {
-	if ((x < 0) || (y < 0) || (x >= ROOM_PATHS_WIDTH) || (x >= ROOM_PATHS_HEIGHT))
+	if ((x < 0) || (y < 0) || (x >= ROOM_PATHS_WIDTH) || (y >= ROOM_PATHS_HEIGHT))
 		return;
-
-	byte *p = &_data[y * 5 + (x % 8)];
+	byte *p = &_data[y * 5 + (x / 8)];
 	byte bitMask = 0x80 >> (x % 8);
 
 	for (int bitCtr = 0; bitCtr < width; ++bitCtr) {
@@ -135,14 +134,13 @@
 }
 
 void RoomPathsData::clearOccupied(int x, int y, int width) {
-	if ((x < 0) || (y < 0) || (x >= ROOM_PATHS_WIDTH) || (x >= ROOM_PATHS_HEIGHT))
+	if ((x < 0) || (y < 0) || (x >= ROOM_PATHS_WIDTH) || (y >= ROOM_PATHS_HEIGHT))
 		return;
-
-	byte *p = &_data[y * 5 + (x % 8)];
+	byte *p = &_data[y * 5 + (x / 8)];
 	byte bitMask = 0x80 >> (x % 8);
 
 	for (int bitCtr = 0; bitCtr < width; ++bitCtr) {
-		*p &= !bitMask;
+		*p &= ~bitMask;
 		bitMask >>= 1;
 		if (bitMask == 0) {
 			++p;
@@ -274,6 +272,8 @@
 	widthCopy = READ_LE_UINT16(&rec->widthCopy);
 	heightCopy = READ_LE_UINT16(&rec->heightCopy);
 	yCorrection = READ_LE_UINT16(&rec->yCorrection);
+	walkX = READ_LE_INT16(&rec->walkX);
+	walkY = READ_LE_UINT16(&rec->walkY);
 	talkX = rec->talkX;
 	talkY = rec->talkY;
 	colourOffset = READ_LE_UINT16(&rec->colourOffset);
@@ -481,25 +481,6 @@
 	}
 }
 
-// The following class holds the proximity data for hotspots that is used
-// to determine whether a character needs to walk to a hotspot or not
-
-HotspotProximityData::HotspotProximityData(HotspotProximityResource *rec) {
-	hotspotId = FROM_LE_16(rec->hotspotId);
-	x = FROM_LE_16(rec->x);
-	y = FROM_LE_16(rec->y);
-}
-
-HotspotProximityData *HotspotProximityList::getHotspot(uint16 hotspotId) {
-	iterator i;
-	for (i = begin(); i != end(); ++i) {
-		HotspotProximityData *rec = *i;
-		if (rec->hotspotId == hotspotId) return rec;
-	}
-
-	return NULL;
-}
-
 // Field list and miscellaneous variables
 
 ValueTableData::ValueTableData() {

Modified: scummvm/trunk/engines/lure/res_struct.h
===================================================================
--- scummvm/trunk/engines/lure/res_struct.h	2006-04-29 11:13:47 UTC (rev 22204)
+++ scummvm/trunk/engines/lure/res_struct.h	2006-04-29 11:15:03 UTC (rev 22205)
@@ -73,6 +73,8 @@
 	uint16 widthCopy;
 	uint16 heightCopy;
 	uint16 yCorrection;
+	int16 walkX;
+	uint16 walkY;
 	int8 talkX;
 	int8 talkY;
 	uint16 colourOffset;
@@ -177,12 +179,6 @@
 	uint16 sequenceId3;
 } GCC_PACK;
 
-struct HotspotProximityResource {
-	uint16 hotspotId;
-	uint16 x;
-	uint16 y;
-} GCC_PACK;
-
 struct RoomExitCoordinateResource {
 	int16 x;
 	int16 y;
@@ -378,6 +374,8 @@
 	uint16 widthCopy;
 	uint16 heightCopy;
 	uint16 yCorrection;
+	int16 walkX;
+	uint16 walkY;
 	int8 talkX;
 	int8 talkY;
 	uint16 colourOffset;
@@ -385,9 +383,10 @@
 	uint16 sequenceOffset;
 	uint16 tickProcOffset;
 	uint16 tickTimeout;
-
+	
 	void enable() { flags |= 0x80; }
 	void disable() { flags &= 0x7F; }
+	Direction nonVisualDirection() { return (Direction) scriptLoadFlag; }
 };
 
 typedef ManagedList<HotspotData *> HotspotDataList;
@@ -514,25 +513,6 @@
 	void tick();
 };
 
-class HotspotProximityData {
-public:
-	HotspotProximityData(HotspotProximityResource *rec);
-
-	uint16 hotspotId;
-	uint16 x;
-	uint16 y;
-};
-
-class HotspotProximityList: public ManagedList<HotspotProximityData *> {
-public:
-	HotspotProximityData *getHotspot(uint16 hotspotId);
-};
-
-struct PlayerNewPosition {
-	Point position;
-	uint16 roomNumber;
-};
-
 // The following class holds the field list used by the script engine as 
 // well as miscellaneous fields used by the game.                          
 
@@ -555,6 +535,11 @@
 	SACK_CUT = 20
 };
 
+struct PlayerNewPosition {
+	Point position;
+	uint16 roomNumber;
+};
+
 class ValueTableData {
 private:
 	uint16 _numGroats;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.





More information about the Scummvm-git-logs mailing list