diff options
author | Paul Gilbert | 2008-10-05 10:25:35 +0000 |
---|---|---|
committer | Paul Gilbert | 2008-10-05 10:25:35 +0000 |
commit | b9a0e32c3c318f95bb52e42afd7aa56e461b2756 (patch) | |
tree | c22f37571e9f0addb6dac4e2d9b38ff90c90d0cf /engines/lure | |
parent | 99f8add65cb61d1e8da23f734da249687d24919e (diff) | |
download | scummvm-rg350-b9a0e32c3c318f95bb52e42afd7aa56e461b2756.tar.gz scummvm-rg350-b9a0e32c3c318f95bb52e42afd7aa56e461b2756.tar.bz2 scummvm-rg350-b9a0e32c3c318f95bb52e42afd7aa56e461b2756.zip |
Changed NPC schedules to be loaded when an NPC is activated - this avoids an issue with the Castle Skorl's pre-activation room number being invalid room #99
svn-id: r34748
Diffstat (limited to 'engines/lure')
-rw-r--r-- | engines/lure/res.cpp | 7 | ||||
-rw-r--r-- | engines/lure/res_struct.cpp | 9 | ||||
-rw-r--r-- | engines/lure/res_struct.h | 1 |
3 files changed, 10 insertions, 7 deletions
diff --git a/engines/lure/res.cpp b/engines/lure/res.cpp index 68de260061..2d69c9e931 100644 --- a/engines/lure/res.cpp +++ b/engines/lure/res.cpp @@ -558,6 +558,13 @@ Hotspot *Resources::activateHotspot(uint16 hotspotId) { if (h != NULL) return h; + // If it's NPC with a schedule, then activate the schedule + if ((res->npcScheduleId != 0) && (res->npcSchedule.isEmpty())) { + Resources &resources = Resources::getReference(); + CharacterScheduleEntry *entry = resources.charSchedules().getEntry(res->npcScheduleId); + res->npcSchedule.addFront(DISPATCH_ACTION, entry, res->roomNumber); + } + // Check the script load flag if (res->scriptLoadFlag) { // Execute a script rather than doing a standard load diff --git a/engines/lure/res_struct.cpp b/engines/lure/res_struct.cpp index 92cea948f9..1c4fe883d0 100644 --- a/engines/lure/res_struct.cpp +++ b/engines/lure/res_struct.cpp @@ -434,13 +434,8 @@ HotspotData::HotspotData(HotspotResource *rec) { talkGate = 0; scriptHotspotId = 0; - // Set up NPC schedule if any - uint16 npcScheduleId = READ_LE_UINT16(&rec->npcSchedule); - if (npcScheduleId != 0) { - Resources &res = Resources::getReference(); - CharacterScheduleEntry *entry = res.charSchedules().getEntry(npcScheduleId); - npcSchedule.addFront(DISPATCH_ACTION, entry, roomNumber); - } + // Get the NPC schedule, if any + npcScheduleId = READ_LE_UINT16(&rec->npcSchedule); } void HotspotData::saveToStream(WriteStream *stream) { diff --git a/engines/lure/res_struct.h b/engines/lure/res_struct.h index e2f596292b..684ce5aa17 100644 --- a/engines/lure/res_struct.h +++ b/engines/lure/res_struct.h @@ -543,6 +543,7 @@ public: uint16 delayCtr; uint8 flags2; uint8 headerFlags; + uint16 npcScheduleId; // Runtime fields uint16 actionCtr; |