aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2006-02-19 04:15:33 +0000
committerPaul Gilbert2006-02-19 04:15:33 +0000
commit5d8d871df3edc79e313aa276da7756ceb437e4b7 (patch)
tree7f05827bce36c60680d114b051bcbc8abb5f87a8 /engines
parentd525af4685185971ad701f3ded7e9fd534baba86 (diff)
downloadscummvm-rg350-5d8d871df3edc79e313aa276da7756ceb437e4b7.tar.gz
scummvm-rg350-5d8d871df3edc79e313aa276da7756ceb437e4b7.tar.bz2
scummvm-rg350-5d8d871df3edc79e313aa276da7756ceb437e4b7.zip
Added new resources for conversations, cleaned up existing class names, and expanded hotspot resources to add newly understood fields
svn-id: r20763
Diffstat (limited to 'engines')
-rw-r--r--engines/lure/res_struct.cpp83
-rw-r--r--engines/lure/res_struct.h114
2 files changed, 172 insertions, 25 deletions
diff --git a/engines/lure/res_struct.cpp b/engines/lure/res_struct.cpp
index db01a471cd..a099f51f07 100644
--- a/engines/lure/res_struct.cpp
+++ b/engines/lure/res_struct.cpp
@@ -42,11 +42,14 @@ RoomData::RoomData(RoomResource *rec) {
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 @@ RoomExitData *RoomExitList::checkExits(int16 xp, int16 yp) {
// 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 @@ RoomExitJoinData::RoomExitJoinData(RoomExitJoinRecord *rec) {
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 @@ HotspotData::HotspotData(HotspotResource *rec) {
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 @@ HotspotActionList::HotspotActionList(uint16 id, byte *data) {
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 @@ HotspotActionList *HotspotActionSet::getActions(uint16 recordId) {
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 @@ ValueTableData::ValueTableData() {
}
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) {
diff --git a/engines/lure/res_struct.h b/engines/lure/res_struct.h
index 418fb9fbdd..2b1384a056 100644
--- a/engines/lure/res_struct.h
+++ b/engines/lure/res_struct.h
@@ -39,6 +39,20 @@ extern const char *actionList[];
#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 @@ struct HotspotResource {
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 @@ struct RoomResource {
uint16 numLayers;
uint16 layers[4];
uint16 sequenceOffset;
+ int16 clippingXStart;
+ int16 clippingXEnd;
uint16 numExits;
} GCC_PACK;
@@ -104,7 +124,7 @@ struct HotspotOverrideResource {
int16 xs, xe, ys, ye;
} GCC_PACK;
-struct RoomExitHotspotRecord {
+struct RoomExitHotspotResource {
uint16 hotspotId;
int16 xs, xe;
int16 ys, ye;
@@ -112,7 +132,7 @@ struct RoomExitHotspotRecord {
uint16 destRoomNumber;
} GCC_PACK;
-struct RoomExitJoinRecord {
+struct RoomExitJoinResource {
uint16 hotspot1Id;
byte h1CurrentFrame;
byte h1DestFrame;
@@ -125,23 +145,32 @@ struct RoomExitJoinRecord {
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__)
@@ -189,7 +218,7 @@ enum Direction {UP, DOWN, LEFT, RIGHT, NO_DIRECTION};
class RoomExitHotspotData {
public:
- RoomExitHotspotData(RoomExitHotspotRecord *rec);
+ RoomExitHotspotData(RoomExitHotspotResource *rec);
uint16 hotspotId;
int16 xs, xe;
@@ -228,6 +257,8 @@ public:
uint16 numLayers;
uint16 layers[MAX_NUM_LAYERS];
uint16 sequenceOffset;
+ int16 clippingXStart;
+ int16 clippingXEnd;
RoomExitHotspotList exitHotspots;
RoomExitList exits;
};
@@ -236,7 +267,7 @@ typedef ManagedList<RoomData *> RoomDataList;
class RoomExitJoinData {
public:
- RoomExitJoinData(RoomExitJoinRecord *rec);
+ RoomExitJoinData(RoomExitJoinResource *rec);
uint16 hotspot1Id;
byte h1CurrentFrame;
@@ -254,7 +285,7 @@ typedef ManagedList<RoomExitJoinData *> RoomExitJoinList;
class HotspotActionData {
public:
- HotspotActionData(HotspotActionRecord *rec);
+ HotspotActionData(HotspotActionResource *rec);
Action action;
uint16 sequenceOffset;
@@ -292,6 +323,10 @@ public:
int16 startY;
uint16 width;
uint16 height;
+ uint16 widthCopy;
+ uint16 heightCopy;
+ int8 talkX;
+ int8 talkY;
uint16 colourOffset;
uint16 animRecordId;
uint16 sequenceOffset;
@@ -344,6 +379,47 @@ public:
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 @@ enum FieldName {
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
};