aboutsummaryrefslogtreecommitdiff
path: root/engines/lure/res_struct.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2007-02-26 02:50:23 +0000
committerPaul Gilbert2007-02-26 02:50:23 +0000
commit4f8c66b4cc30a07b8a82b70e8280a931858e8175 (patch)
tree4c9e23001ea39dfe848a55d6a26e445efcb02df8 /engines/lure/res_struct.cpp
parent04159e06227f2ef67535e72e574663ab486d14a8 (diff)
downloadscummvm-rg350-4f8c66b4cc30a07b8a82b70e8280a931858e8175.tar.gz
scummvm-rg350-4f8c66b4cc30a07b8a82b70e8280a931858e8175.tar.bz2
scummvm-rg350-4f8c66b4cc30a07b8a82b70e8280a931858e8175.zip
Added saving of the random actions set state, and implemented NPC opcode 29, which allows for an NPC to be given a custom talk record
svn-id: r25875
Diffstat (limited to 'engines/lure/res_struct.cpp')
-rw-r--r--engines/lure/res_struct.cpp24
1 files changed, 20 insertions, 4 deletions
diff --git a/engines/lure/res_struct.cpp b/engines/lure/res_struct.cpp
index 6a3985e097..fe182d3fec 100644
--- a/engines/lure/res_struct.cpp
+++ b/engines/lure/res_struct.cpp
@@ -312,6 +312,7 @@ HotspotData::HotspotData(HotspotResource *rec) {
useHotspotId = 0;
v2b = 0;
actionHotspotId = 0;
+ talkOverride = 0;
}
void HotspotData::saveToStream(WriteStream *stream) {
@@ -351,6 +352,7 @@ void HotspotData::saveToStream(WriteStream *stream) {
stream->writeUint16LE(use2HotspotId);
stream->writeUint16LE(v2b);
stream->writeUint16LE(actionHotspotId);
+ stream->writeUint16LE(talkOverride);
}
void HotspotData::loadFromStream(ReadStream *stream) {
@@ -390,6 +392,7 @@ void HotspotData::loadFromStream(ReadStream *stream) {
use2HotspotId = stream->readUint16LE();
v2b = stream->readUint16LE();
actionHotspotId = stream->readUint16LE();
+ talkOverride = stream->readUint16LE();
}
// Hotspot data list
@@ -806,16 +809,29 @@ RandomActionSet *RandomActionList::getRoom(uint16 roomNumber) {
return NULL;
}
-void RandomActionList::saveToStream(Common::WriteStream *stream) {
-
+void RandomActionSet::saveToStream(Common::WriteStream *stream) {
+ stream->writeByte(numActions());
+ for (int actionIndex = 0; actionIndex < _numActions; ++actionIndex)
+ stream->writeByte((byte)_types[actionIndex]);
}
-void RandomActionList::loadFromStream(Common::ReadStream *stream) {
-
+void RandomActionSet::loadFromStream(Common::ReadStream *stream) {
+ int amount = stream->readByte();
+ assert(amount == _numActions);
+ for (int actionIndex = 0; actionIndex < _numActions; ++actionIndex)
+ _types[actionIndex] = (RandomActionType)stream->readByte();
}
+void RandomActionList::saveToStream(Common::WriteStream *stream) {
+ for (iterator i = begin(); i != end(); ++i)
+ (*i)->saveToStream(stream);
+}
+void RandomActionList::loadFromStream(Common::ReadStream *stream) {
+ for (iterator i = begin(); i != end(); ++i)
+ (*i)->loadFromStream(stream);
+}
// This class handles an indexed hotspot entry - which is used by the NPC code to
// determine whether exiting a room to another given room has an exit hotspot or not