Implemented the Tell action handling, and added support for current actions with dynamic support data

svn-id: r23810
This commit is contained in:
Paul Gilbert 2006-08-30 12:19:05 +00:00
parent e0d2b0764f
commit 3e54f04f3d
2 changed files with 44 additions and 15 deletions

View File

@ -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();

View File

@ -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 {