aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/lure/res_struct.cpp49
-rw-r--r--engines/lure/res_struct.h15
2 files changed, 59 insertions, 5 deletions
diff --git a/engines/lure/res_struct.cpp b/engines/lure/res_struct.cpp
index 8c68462bf6..864a37583c 100644
--- a/engines/lure/res_struct.cpp
+++ b/engines/lure/res_struct.cpp
@@ -67,6 +67,12 @@ BarEntry barList[3] = {
&ewanExtraGraphic1[0], &ewanExtraGraphic2[0]}, 16, NULL}
};
+RoomTranslationRecord roomTranslations[] = {
+ {0x1E, 0x13}, {0x07, 0x08}, {0x1C, 0x12}, {0x26, 0x0F},
+ {0x27, 0x0F}, {0x28, 0x0F}, {0x29, 0x0F}, {0x22, 0x0A},
+ {0x23, 0x13}, {0x24, 0x14}, {0x31, 0x2C}, {0x2F, 0x2C},
+ {0, 0}};
+
// Room data holding class
RoomData::RoomData(RoomResource *rec, MemoryBlock *pathData) {
@@ -701,12 +707,20 @@ RoomExitCoordinateData &RoomExitCoordinates::getData(uint16 destRoomNumber) {
SequenceDelayData::SequenceDelayData(uint16 delay, uint16 seqOffset, bool canClearFlag) {
OSystem &system = *g_system;
- // The delay is in number of ticks (1/18th of a second) - convert to milliseconds
- timeoutCtr = system.getMillis() + (delay * 1000 / 18);
+ // The delay is in number of seconds
+ timeoutCtr = system.getMillis() + delay * 1000;
sequenceOffset = seqOffset;
canClear = canClearFlag;
}
+SequenceDelayData *SequenceDelayData::load(uint32 delay, uint16 seqOffset, bool canClearFlag) {
+ SequenceDelayData *result = new SequenceDelayData();
+ result->sequenceOffset = seqOffset;
+ result->timeoutCtr = delay;
+ result->canClear = canClearFlag;
+ return result;
+}
+
void SequenceDelayList::add(uint16 delay, uint16 seqOffset, bool canClear) {
SequenceDelayData *entry = new SequenceDelayData(delay, seqOffset, canClear);
push_front(entry);
@@ -728,18 +742,45 @@ void SequenceDelayList::tick() {
}
}
-void SequenceDelayList::clear() {
+void SequenceDelayList::clear(bool forceClear) {
SequenceDelayList::iterator i = begin();
while (i != end()) {
SequenceDelayData *entry = *i;
- if (entry->canClear)
+ if (entry->canClear || forceClear)
i = erase(i);
else
++i;
}
}
+void SequenceDelayList::saveToStream(WriteStream *stream) {
+ uint32 currTime = g_system->getMillis();
+ SequenceDelayList::iterator i;
+
+ for (i = begin(); i != end(); ++i) {
+ SequenceDelayData *entry = *i;
+ stream->writeUint16LE(entry->sequenceOffset);
+ stream->writeUint32LE((currTime > entry->timeoutCtr ) ? 0 :
+ entry->timeoutCtr - currTime);
+ stream->writeByte(entry->canClear);
+ }
+
+ stream->writeUint16LE(0);
+}
+
+void SequenceDelayList::loadFromStream(ReadStream *stream) {
+ clear(true);
+ uint16 seqOffset;
+ uint32 currTime = g_system->getMillis();
+
+ while ((seqOffset = stream->readUint16LE()) != 0) {
+ uint32 delay = currTime + stream->readUint32LE();
+ bool canClear = stream->readByte() != 0;
+ push_back(SequenceDelayData::load(delay, seqOffset, canClear));
+ }
+}
+
// The following classes hold the NPC schedule classes
CharacterScheduleEntry::CharacterScheduleEntry(Action theAction, ...) {
diff --git a/engines/lure/res_struct.h b/engines/lure/res_struct.h
index f53f8dd9a0..1a9833c686 100644
--- a/engines/lure/res_struct.h
+++ b/engines/lure/res_struct.h
@@ -589,8 +589,11 @@ public:
// The following classes hold any sequence offsets that are being delayed
class SequenceDelayData {
+private:
+ SequenceDelayData() {};
public:
SequenceDelayData(uint16 delay, uint16 seqOffset, bool canClearFlag);
+ static SequenceDelayData *load(uint32 delay, uint16 seqOffset, bool canClearFlag);
uint32 timeoutCtr;
uint16 sequenceOffset;
@@ -601,7 +604,10 @@ class SequenceDelayList: public ManagedList<SequenceDelayData *> {
public:
void add(uint16 delay, uint16 seqOffset, bool canClear);
void tick();
- void clear();
+ void clear(bool forceClear = false);
+
+ void saveToStream(WriteStream *stream);
+ void loadFromStream(ReadStream *stream);
};
// The following classes holds the data for NPC schedules
@@ -732,6 +738,13 @@ public:
enum BarmanAction {WALK_AROUND = 1, POLISH_BAR = 2, WAIT = 3, WAIT_DIALOG = 4, SERVE_BEER = 5};
+struct RoomTranslationRecord {
+ uint8 srcRoom;
+ uint8 destRoom;
+};
+
+extern RoomTranslationRecord roomTranslations[];
+
enum StringEnum {S_CREDITS = 25, S_RESTART_GAME = 26, S_SAVE_GAME = 27, S_RESTORE_GAME = 28,
S_QUIT = 29, S_FAST_TEXT = 30, S_SLOW_TEXT = 31, S_SOUND_ON = 32, S_SOUND_OFF = 33,
S_NOTHING = 34, S_FOR = 35, S_TO = 36, S_ON = 37, S_AND_THEN = 38,