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

dreammaster at users.sourceforge.net dreammaster at users.sourceforge.net
Sat Feb 18 20:16:03 CET 2006


Revision: 20763
Author:   dreammaster
Date:     2006-02-18 20:15:33 -0800 (Sat, 18 Feb 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm?rev=20763&view=rev

Log Message:
-----------
Added new resources for conversations, cleaned up existing class names, and expanded hotspot resources to add newly understood fields

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-02-19 04:13:08 UTC (rev 20762)
+++ scummvm/trunk/engines/lure/res_struct.cpp	2006-02-19 04:15:33 UTC (rev 20763)
@@ -42,11 +42,14 @@
 
 	for (int ctr = 0; ctr < 4; ++ctr)
 		layers[ctr] = READ_LE_UINT16(&rec->layers[ctr]);
+
+	clippingXStart = READ_LE_UINT16(&rec->clippingXStart);
+	clippingXEnd = READ_LE_UINT16(&rec->clippingXEnd);
 }
 
 // Room exit hotspot area holding class
 
-RoomExitHotspotData::RoomExitHotspotData(RoomExitHotspotRecord *rec) {
+RoomExitHotspotData::RoomExitHotspotData(RoomExitHotspotResource *rec) {
 	hotspotId = READ_LE_UINT16(&rec->hotspotId);
 	xs = READ_LE_INT16(&rec->xs);
 	ys = READ_LE_INT16(&rec->ys);
@@ -102,7 +105,7 @@
 
 // Room exit joins class
 
-RoomExitJoinData::RoomExitJoinData(RoomExitJoinRecord *rec) {
+RoomExitJoinData::RoomExitJoinData(RoomExitJoinResource *rec) {
 	hotspot1Id = READ_LE_UINT16(&rec->hotspot1Id);
 	h1CurrentFrame = rec->h1CurrentFrame;
 	h1DestFrame = rec->h1DestFrame;
@@ -112,12 +115,12 @@
 	h2DestFrame = rec->h2DestFrame;
 	h2Unknown = READ_LE_UINT16(&rec->h2Unknown);
 	blocked = rec->blocked;
-	unknown = READ_LE_UINT32(&rec->unknown);
+	unknown = rec->unknown;
 }
 
 // Hotspot action record
 
-HotspotActionData::HotspotActionData(HotspotActionRecord *rec) {
+HotspotActionData::HotspotActionData(HotspotActionResource *rec) {
 	action = (Action) rec->action;
 	sequenceOffset = READ_LE_UINT16(&rec->sequenceOffset);
 }
@@ -153,6 +156,10 @@
 	startY = READ_LE_INT16(&rec->startY);
 	width = READ_LE_UINT16(&rec->width);
 	height = READ_LE_UINT16(&rec->height);
+	widthCopy = READ_LE_UINT16(&rec->widthCopy);
+	heightCopy = READ_LE_UINT16(&rec->heightCopy);
+	talkX = rec->talkX;
+	talkY = rec->talkY;
 	colourOffset = READ_LE_UINT16(&rec->colourOffset);
 	animRecordId = READ_LE_UINT16(&rec->animRecordId);
 	sequenceOffset = READ_LE_UINT16(&rec->sequenceOffset);
@@ -221,7 +228,7 @@
 	uint16  numItems = READ_LE_UINT16(data);
 	data += 2;
 
-	HotspotActionRecord *actionRec = (HotspotActionRecord *) data;
+	HotspotActionResource *actionRec = (HotspotActionResource *) data;
 	
 	for (int actionCtr = 0; actionCtr < numItems; ++actionCtr, ++actionRec) {
 		HotspotActionData *actionEntry = new HotspotActionData(actionRec);
@@ -239,6 +246,68 @@
 	return NULL;
 }
 
+// The following class holds the set of offsets for a character's talk set
+
+TalkHeaderData::TalkHeaderData(uint16 charId, uint16 *entries) {
+	uint16 *src, *dest;
+	characterId = charId;
+
+	// Get number of entries
+	_numEntries = 0;
+	src = entries;
+	while (READ_LE_UINT16(src) != 0xffff) { ++src; ++_numEntries; }
+
+	// Duplicate the list
+	_data = (uint16 *) Memory::alloc(_numEntries * sizeof(uint16));
+	src = entries; dest = _data;
+
+	for (int ctr = 0; ctr < _numEntries; ++ctr, ++src, ++dest)
+		*dest = READ_LE_UINT16(src);
+}
+
+TalkHeaderData::~TalkHeaderData() {
+	free(_data);
+}
+
+uint16 TalkHeaderData::getEntry(int index) {
+	if (index >= _numEntries) 
+		error("Invalid talk index %d specified for hotspot %xh", 
+			_numEntries, characterId);
+	return _data[index];
+}
+
+// The following class holds a single talking entry
+
+TalkEntryData::TalkEntryData(TalkDataResource *rec) {
+	preSequenceId = FROM_LE_16(rec->preSequenceId);
+	descId = FROM_LE_16(rec->descId);
+	postSequenceId = FROM_LE_16(rec->postSequenceId);
+}
+
+// The following class acts as a container for all the talk entries and
+// responses for a single record Id
+
+TalkData::TalkData(uint16 id) {
+	recordId = id;
+}
+
+TalkData::~TalkData() {
+	entries.clear();
+	responses.clear();
+}
+
+TalkEntryData *TalkData::getResponse(int index) {
+	TalkEntryList::iterator i = responses.begin();
+	int v = index;
+	while (v-- > 0) {
+		if (i == responses.end()) 
+			error("Invalid talk response index %d specified", index);
+		++i;
+	}
+
+	return *i;
+}
+
 // The following classes hold any sequence offsets that are being delayed
 
 SequenceDelayData::SequenceDelayData(uint16 delay, uint16 seqOffset) {
@@ -278,8 +347,8 @@
 }
 
 bool ValueTableData::isKnownField(uint16 fieldIndex) {
-	return (fieldIndex <= 8) || (fieldIndex == 10) || (fieldIndex == 15) || 
-		(fieldIndex == 18) || (fieldIndex == 20);
+	return ((fieldIndex <= 10) && (fieldIndex != 6)) ||
+		(fieldIndex == 15) || ((fieldIndex >= 18) && (fieldIndex <= 20));
 }
 
 uint16 ValueTableData::getField(uint16 fieldIndex) {

Modified: scummvm/trunk/engines/lure/res_struct.h
===================================================================
--- scummvm/trunk/engines/lure/res_struct.h	2006-02-19 04:13:08 UTC (rev 20762)
+++ scummvm/trunk/engines/lure/res_struct.h	2006-02-19 04:15:33 UTC (rev 20763)
@@ -39,6 +39,20 @@
 #pragma START_PACK_STRUCTS
 #endif
 
+struct VersionStructure {
+	uint16 id;
+	byte vMajor;
+	byte vMinor;
+} GCC_PACK;
+
+struct FileEntry {
+	uint16 id;
+	byte unused;
+	byte sizeExtension;
+	uint16 size;
+	uint16 offset;
+} GCC_PACK;
+
 struct HotspotResource {
 	uint16 hotspotId;
 	uint16 nameId;
@@ -50,10 +64,14 @@
 	byte layer;
 	byte scriptLoadFlag;
 	uint16 loadOffset;
-	int16 startX;
-	int16 startY;
+	uint16 startX;
+	uint16 startY;
 	uint16 width;
 	uint16 height;
+	uint16 widthCopy;
+	uint16 heightCopy;
+	int8 talkX;
+	int8 talkY;
 	uint16 colourOffset;
 	uint16 animRecordId;
 	uint16 sequenceOffset;
@@ -88,6 +106,8 @@
 	uint16 numLayers;
 	uint16 layers[4];
 	uint16 sequenceOffset;
+	int16 clippingXStart;
+	int16 clippingXEnd;
 	uint16 numExits;
 } GCC_PACK;
 
@@ -104,7 +124,7 @@
 	int16 xs, xe, ys, ye;
 } GCC_PACK;
 
-struct RoomExitHotspotRecord {
+struct RoomExitHotspotResource {
 	uint16 hotspotId;
 	int16 xs, xe;
 	int16 ys, ye;
@@ -112,7 +132,7 @@
 	uint16 destRoomNumber;
 } GCC_PACK;
 
-struct RoomExitJoinRecord {
+struct RoomExitJoinResource {
 	uint16 hotspot1Id;
 	byte h1CurrentFrame;
 	byte h1DestFrame;
@@ -125,25 +145,34 @@
 	uint32 unknown;
 } GCC_PACK;
 
-struct HotspotActionRecord {
+struct HotspotActionResource {
 	byte action;
 	uint16 sequenceOffset;
 } GCC_PACK;
 
-struct FileEntry {
-	uint16 id;
-	byte unused;
-	byte sizeExtension;
-	uint16 size;
+struct TalkHeaderResource {
+	uint16 hotspotId;
 	uint16 offset;
 } GCC_PACK;
 
-struct VersionStructure {
-	uint16 id;
-	byte vMajor;
-	byte vMinor;
+struct TalkDataHeaderResource {
+	uint16 recordId;
+	uint16 listOffset;
+	uint16 responsesOffset;
 } GCC_PACK;
 
+struct TalkDataResource {
+	uint16 preSequenceId;
+	uint16 descId;
+	uint16 postSequenceId;
+} GCC_PACK;
+
+struct TalkResponseResource {
+	uint16 sequenceId1;
+	uint16 sequenceId2;
+	uint16 sequenceId3;
+} GCC_PACK;
+
 #if !defined(__GNUC__)
 #pragma END_PACK_STRUCTS
 #endif
@@ -189,7 +218,7 @@
 
 class RoomExitHotspotData {
 public:
-	RoomExitHotspotData(RoomExitHotspotRecord *rec);
+	RoomExitHotspotData(RoomExitHotspotResource *rec);
 
 	uint16 hotspotId;
 	int16 xs, xe;
@@ -228,6 +257,8 @@
 	uint16 numLayers;
 	uint16 layers[MAX_NUM_LAYERS];
 	uint16 sequenceOffset;
+	int16 clippingXStart;
+	int16 clippingXEnd;
 	RoomExitHotspotList exitHotspots;
 	RoomExitList exits;
 };
@@ -236,7 +267,7 @@
 
 class RoomExitJoinData {
 public:
-	RoomExitJoinData(RoomExitJoinRecord *rec);
+	RoomExitJoinData(RoomExitJoinResource *rec);
 
 	uint16 hotspot1Id;
 	byte h1CurrentFrame;
@@ -254,7 +285,7 @@
 
 class HotspotActionData {
 public:
-	HotspotActionData(HotspotActionRecord *rec);
+	HotspotActionData(HotspotActionResource *rec);
 
 	Action action;
 	uint16 sequenceOffset;
@@ -292,6 +323,10 @@
 	int16 startY;
 	uint16 width;
 	uint16 height;
+	uint16 widthCopy;
+	uint16 heightCopy;
+	int8 talkX;
+	int8 talkY;
 	uint16 colourOffset;
 	uint16 animRecordId;
 	uint16 sequenceOffset;
@@ -344,6 +379,47 @@
 
 typedef ManagedList<HotspotAnimData *> HotspotAnimList;
 
+// Talk header list
+
+class TalkHeaderData {
+private:
+	uint16 *_data;
+	int _numEntries;
+public:
+	TalkHeaderData(uint16 charId, uint16 *entries);
+	~TalkHeaderData();
+
+	uint16 characterId;
+	uint16 getEntry(int index);
+};
+
+typedef ManagedList<TalkHeaderData *> TalkHeaderList;
+
+class TalkEntryData {
+public:
+	TalkEntryData(TalkDataResource *rec);
+
+	uint16 preSequenceId;
+	uint16 descId;
+	uint16 postSequenceId;
+};
+
+typedef ManagedList<TalkEntryData *> TalkEntryList;
+
+struct TalkData {
+public:
+	TalkData(uint16 id);
+	~TalkData();
+
+	uint16 recordId;
+	TalkEntryList entries;
+	TalkEntryList responses;
+
+	TalkEntryData *getResponse(int index);
+};
+
+typedef ManagedList<TalkData *> TalkDataList;
+
 // The following classes hold any sequence offsets that are being delayed
 
 class SequenceDelayData {
@@ -374,10 +450,12 @@
 	SEQUENCE_RESULT = 4,
 	GENERAL = 5,
 	NEW_ROOM_NUMBER = 7,
-	GENERAL_STATUS = 8,
+	OLD_ROOM_NUMBER = 8,
+	CELL_DOOR_STATE = 9,
 	TORCH_HIDE = 10,
 	PRISONER_DEAD = 15,
 	BOTTLE_FILLED = 18,
+	TALK_INDEX = 19,
 	SACK_CUT = 20
 };
 







More information about the Scummvm-git-logs mailing list