aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2006-08-30 12:19:05 +0000
committerPaul Gilbert2006-08-30 12:19:05 +0000
commit3e54f04f3d75383b93557edf9263acc7195f8274 (patch)
treee93a370cc9d30270fbc379f1619250e838c404c2 /engines
parente0d2b0764f22028e6c5ad0d7e4b73275c90e358e (diff)
downloadscummvm-rg350-3e54f04f3d75383b93557edf9263acc7195f8274.tar.gz
scummvm-rg350-3e54f04f3d75383b93557edf9263acc7195f8274.tar.bz2
scummvm-rg350-3e54f04f3d75383b93557edf9263acc7195f8274.zip
Implemented the Tell action handling, and added support for current actions with dynamic support data
svn-id: r23810
Diffstat (limited to 'engines')
-rw-r--r--engines/lure/hotspots.cpp38
-rw-r--r--engines/lure/hotspots.h21
2 files changed, 44 insertions, 15 deletions
diff --git a/engines/lure/hotspots.cpp b/engines/lure/hotspots.cpp
index 01336723fd..63c8b5b953 100644
--- a/engines/lure/hotspots.cpp
+++ b/engines/lure/hotspots.cpp
@@ -1296,9 +1296,9 @@ void Hotspot::doTell(HotspotData *hotspot) {
Hotspot *character = res.getActiveHotspot(hotspot->hotspotId);
assert(character);
- HotspotPrecheckResult result = actionPrecheck(hotspot);
- if (result == PC_INITIAL) return;
- else if (result != PC_EXECUTE) {
+ HotspotPrecheckResult hsResult = actionPrecheck(hotspot);
+ if (hsResult == PC_INITIAL) return;
+ else if (hsResult != PC_EXECUTE) {
endAction();
return;
}
@@ -1312,11 +1312,15 @@ void Hotspot::doTell(HotspotData *hotspot) {
uint16 result = Script::execute(sequenceOffset);
if (result == 0) {
+ // Build up sequence of commands for character to follow
+ CharacterScheduleEntry &cmdData = _currentActions.top().supportData();
character->setStartRoomNumber(character->roomNumber());
character->currentActions().clear();
-
- // Build up sequence of commands for character to follow
- error("Tell command handling yet not yet implemented");
+
+ for (int index = 1; index < cmdData.numParams(); index += 3) {
+ character->currentActions().addBack((Action) cmdData.param(index),
+ character->roomNumber(), cmdData.param(index + 1), cmdData.param(index + 2));
+ }
}
}
@@ -3308,6 +3312,28 @@ void PathFinder::initVars() {
// Current action entry class methods
+CurrentActionEntry::CurrentActionEntry(CurrentAction newAction, uint16 roomNum) {
+ _action = newAction;
+ _supportData = NULL;
+ _dynamicSupportData = false;
+ _roomNumber = roomNum;
+}
+
+CurrentActionEntry::CurrentActionEntry(CurrentAction newAction, CharacterScheduleEntry *data, uint16 roomNum) {
+ _action = newAction;
+ _supportData = data;
+ _dynamicSupportData = false;
+ _roomNumber = roomNum;
+}
+
+CurrentActionEntry::CurrentActionEntry(Action newAction, uint16 roomNum, uint16 param1, uint16 param2) {
+ _action = DISPATCH_ACTION;
+ _supportData = new CharacterScheduleEntry();
+ uint16 params[2] = {param1, param2};
+ _supportData->setDetails2(newAction, 2, params);
+ _roomNumber = roomNum;
+}
+
void CurrentActionEntry::setSupportData(uint16 entryId) {
CharacterScheduleEntry &entry = supportData();
diff --git a/engines/lure/hotspots.h b/engines/lure/hotspots.h
index d6ccd3dee5..ae35e3f148 100644
--- a/engines/lure/hotspots.h
+++ b/engines/lure/hotspots.h
@@ -83,16 +83,13 @@ private:
CurrentAction _action;
CharacterScheduleEntry *_supportData;
uint16 _roomNumber;
+ bool _dynamicSupportData;
public:
- CurrentActionEntry(CurrentAction newAction, uint16 roomNum) {
- _action = newAction;
- _supportData = NULL;
- _roomNumber = roomNum;
- }
- CurrentActionEntry(CurrentAction newAction, CharacterScheduleEntry *data, uint16 roomNum) {
- _action = newAction;
- _supportData = data;
- _roomNumber = roomNum;
+ CurrentActionEntry(CurrentAction newAction, uint16 roomNum);
+ CurrentActionEntry(CurrentAction newAction, CharacterScheduleEntry *data, uint16 roomNum);
+ CurrentActionEntry(Action newAction, uint16 roomNum, uint16 param1, uint16 param2);
+ virtual ~CurrentActionEntry() {
+ if (_dynamicSupportData) delete _supportData;
}
CurrentAction action() { return _action; }
@@ -129,12 +126,18 @@ public:
void addBack(CurrentAction newAction, CharacterScheduleEntry *rec, uint16 roomNum) {
_actions.push_back(new CurrentActionEntry(newAction, rec, roomNum));
}
+ void addBack(Action newAction, uint16 roomNum, uint16 param1, uint16 param2) {
+ _actions.push_back(new CurrentActionEntry(newAction, roomNum, param1, param2));
+ }
void addFront(CurrentAction newAction, uint16 roomNum) {
_actions.push_front(new CurrentActionEntry(newAction, roomNum));
}
void addFront(CurrentAction newAction, CharacterScheduleEntry *rec, uint16 roomNum) {
_actions.push_front(new CurrentActionEntry(newAction, rec, roomNum));
}
+ void addFront(Action newAction, uint16 roomNum, uint16 param1, uint16 param2) {
+ _actions.push_front(new CurrentActionEntry(newAction, roomNum, param1, param2));
+ }
};
class WalkingActionEntry {