diff options
| author | Peter Kohaut | 2017-03-23 00:25:38 +0100 | 
|---|---|---|
| committer | Peter Kohaut | 2017-03-23 00:25:38 +0100 | 
| commit | 52476b0778d4e02a67b61793b9ebeb1725658b40 (patch) | |
| tree | 1bf0c812944a124854b13eb63597cd12ad683d56 | |
| parent | c084e987d8b3558d5f84f37712fa3bb36fef413f (diff) | |
| download | scummvm-rg350-52476b0778d4e02a67b61793b9ebeb1725658b40.tar.gz scummvm-rg350-52476b0778d4e02a67b61793b9ebeb1725658b40.tar.bz2 scummvm-rg350-52476b0778d4e02a67b61793b9ebeb1725658b40.zip  | |
BLADERUNNER: Added more functionality to movement track
| -rw-r--r-- | engines/bladerunner/actor.cpp | 268 | ||||
| -rw-r--r-- | engines/bladerunner/actor.h | 28 | ||||
| -rw-r--r-- | engines/bladerunner/bladerunner.cpp | 3 | ||||
| -rw-r--r-- | engines/bladerunner/movement_track.cpp | 40 | ||||
| -rw-r--r-- | engines/bladerunner/movement_track.h | 14 | ||||
| -rw-r--r-- | engines/bladerunner/script/ai_00_mccoy.cpp | 2 | ||||
| -rw-r--r-- | engines/bladerunner/script/ai_15_runciter.cpp | 4 | ||||
| -rw-r--r-- | engines/bladerunner/script/ai_23_officer_leroy.cpp | 4 | ||||
| -rw-r--r-- | engines/bladerunner/script/script.cpp | 65 | ||||
| -rw-r--r-- | engines/bladerunner/script/script.h | 4 | 
10 files changed, 287 insertions, 145 deletions
diff --git a/engines/bladerunner/actor.cpp b/engines/bladerunner/actor.cpp index bdcef02e92..37429283dc 100644 --- a/engines/bladerunner/actor.cpp +++ b/engines/bladerunner/actor.cpp @@ -91,6 +91,9 @@ void Actor::setup(int actorId) {  	_retiredWidth = 0;  	_retiredHeight = 0; +	_movementTrackWalkingToWaypointId = -1; +	_movementTrackDelayOnNextWaypoint = -1; +  	for (int i = 0; i != 7; ++i) {  		_timersRemain[i] = 0;  		_timersStart[i] = _vm->getTotalPlayTime(); @@ -107,6 +110,12 @@ void Actor::setup(int actorId) {  	_maxHP = 50;  	_goalNumber = -1; +	_movementTrackPaused = false; +	_movementTrackNextWaypointId = -1; +	_movementTrackNextDelay = -1; +	_movementTrackNextAngle = -1; +	_movementTrackNextRunning = false; +  	_timersRemain[4] = 60000;  	_animationMode = -1;  	_screenRectangle = Common::Rect(-1, -1, -1, -1); @@ -151,30 +160,174 @@ void Actor::setFPS(int fps) {  	}  } -void Actor::processMovement() { -	/*if (movementTrack::is_paused(this->movementTrack) != 1 && this->id) -	{ -		if (this->walkingWaypointId >= 0 && this->timeoutWalkingWaypoint >= 0) -		{ -			worldWaypoints::get_sceneId(WorldWaypoints, this->walkingWaypointId); -			if (!this->timeoutWalkingWaypoint) -			{ -				this->timeoutWalkingWaypoint = 1; +void Actor::countdownTimerStart(int timerId, int interval) { +	assert(timerId >= 0 && timerId < 7); +	_timersRemain[timerId] = interval; +	_timersStart[timerId] = _vm->getTotalPlayTime(); +} + +void Actor::countdownTimerReset(int timerId) { +	assert(timerId >= 0 && timerId < 7); +	_timersRemain[timerId] = 0; +} + +int Actor::countdownTimerGetRemainingTime(int timerId) { +	assert(timerId >= 0 && timerId < 7); +	return _timersRemain[timerId]; +} + +void Actor::countdownTimersUpdate() { +	for (int i = 0; i <= 6; i++) { +		countdownTimerUpdate(i); +	} +} + +void Actor::countdownTimerUpdate(int timerId) { +	if (_timersRemain[timerId] == 0) { +		return; +	} + +	uint32 now = _vm->getTotalPlayTime(); +	int tickInterval = now - _timersStart[timerId]; +	_timersStart[timerId] = now; + +	//warning("tickInterval: %d", tickInterval); +	_timersRemain[timerId] -= tickInterval; + +	if (_timersRemain[timerId] <= 0) { +		switch (timerId) { +		case 0: +		case 1: +		case 2: +			if (!_vm->_aiScripts->IsInsideScript() && !_vm->_script->IsInsideScript()) { +				_vm->_aiScripts->TimerExpired(this->_id, timerId); +				this->_timersRemain[timerId] = 0; +			} else { +				this->_timersRemain[timerId] = 1; +			} +			break; +		case 3: +			_timersRemain[3] = 0; +			if (_movementTrack->isPaused()) { +				_timersRemain[3] = 1; +			} else { +				movementTrackNext(false); +			} +			break; +		case 4: +			// Something timer +			break; +		case 5: +			// Actor animation frame timer +			break; +		case 6: +			if (isRunning()) { +				if (_fps > 15) { +					int newFps = _fps - 2; +					if (newFps < 15) { +						newFps = 15; +					} +					setFPS(newFps); +				} +			} +			_timersRemain[6] = 200; +			break; +		} +	} +} + +void Actor::movementTrackNext(bool omitAiScript) { +	bool hasNextMovement; +	int waypointSetId; +	int running; +	int angle; +	int delay; +	int waypointId; +	Vector3 waypointPosition; +	bool stopped; + +	hasNextMovement = _movementTrack->next(&waypointId, &delay, &angle, &running); +	_movementTrackNextWaypointId = waypointId; +	_movementTrackNextDelay = delay; +	_movementTrackNextAngle = angle; +	_movementTrackNextRunning = running; +	if (hasNextMovement) { +		if (angle == -1) { +			angle = 0; +		} +		waypointSetId = _vm->_waypoints->getSetId(waypointId); +		_vm->_waypoints->getXYZ(waypointId, &waypointPosition.x, &waypointPosition.y, &waypointPosition.z); +		if (_setId == waypointSetId && waypointSetId == _vm->_actors[0]->_setId) { +			stopWalking(false); +			_walkInfo->setup(_id, running, _position, waypointPosition, false, &stopped); + +			_movementTrackWalkingToWaypointId = waypointId; +			_movementTrackDelayOnNextWaypoint = delay; +			if (stopped) { +				movementTrackWaypointReached(); +			} +		} else { +			setSetId(waypointSetId); +			setAtXYZ(waypointPosition, angle, true, false, false); + +			if (!delay) { +				delay = 1; +			} +			if (delay > 1) { +				changeAnimationMode(0, false); +			} +			countdownTimerStart(3, delay); +		} +		//return true; +	} else { +		if (!omitAiScript) { +			_vm->_aiScripts->CompletedMovementTrack(_id); +		} +		//return false; +	} +} + +void Actor::movementTrackPause() { +	_movementTrack->pause(); +	if (isWalking()) { +		_movementTrackPaused = true; +		stopWalking(false); +	} else { +		_movementTrackPaused = false; +	} +} + +void Actor::movementTrackUnpause() { +	Vector3 waypointPosition; +	bool stopped; + +	_movementTrack->unpause(); +	if (_movementTrackNextWaypointId >= 0 && _movementTrackPaused) { +		_vm->_waypoints->getXYZ(_movementTrackNextWaypointId, &waypointPosition.x, &waypointPosition.y, &waypointPosition.z); +		_walkInfo->setup(_id, _movementTrackNextRunning, _position, waypointPosition, false, &stopped); +		_movementTrackPaused = false; +	} +} + +void Actor::movementTrackWaypointReached() { +	int seconds; +	if (!_movementTrack->isPaused() && _id != 0) { +		if (_movementTrackWalkingToWaypointId >= 0 && _movementTrackDelayOnNextWaypoint) { +			if (!_movementTrackDelayOnNextWaypoint) { +				_movementTrackDelayOnNextWaypoint = 1;  			} -			if (actorScript::call_ReachedMovementTrackWaypoint(ActorScript, this->id, this->walkingWaypointId) == 1) -			{ -				seconds = this->timeoutWalkingWaypoint; -				if (seconds > 1) -				{ -					actor::changeAnimationMode(this, 0, 0); -					seconds = this->timeoutWalkingWaypoint; +			if (_vm->_aiScripts->ReachedMovementTrackWaypoint(_id, _movementTrackWalkingToWaypointId)) { +				seconds = _movementTrackDelayOnNextWaypoint; +				if (seconds > 1) { +					changeAnimationMode(0, false); +					seconds = _movementTrackDelayOnNextWaypoint; // todo: analyze if movement is changed in some aiscript->ChangeAnimationMode?  				} -				actor::startTimer(this, 3, seconds); +				countdownTimerStart(3, seconds);  			}  		} -		this->walkingWaypointId = -1; -		this->timeoutWalkingWaypoint = 0; -	}*/ +		_movementTrackWalkingToWaypointId = -1; +		_movementTrackDelayOnNextWaypoint = 0; +	}  }  bool Actor::loopWalkToActor(int otherActorId, int destinationOffset, int a3, bool run, bool a5, bool *isRunning) { @@ -375,10 +528,8 @@ bool Actor::loopWalkToSceneObject(const char *objectName, int destinationOffset,  }  bool Actor::loopWalkToWaypoint(int waypointId, int destinationOffset, int a3, bool run, bool a5, bool *isRunning) { -	float x, y, z; -	_vm->_waypoints->getXYZ(waypointId, &x, &y, &z); -	Vector3 waypointPosition(x, y, z); - +	Vector3 waypointPosition; +	_vm->_waypoints->getXYZ(waypointId, &waypointPosition.x, &waypointPosition.y, &waypointPosition.z);  	return loopWalk(waypointPosition, destinationOffset, a3, run, _position, 0.0f, 24.0f, a5, isRunning, false);  } @@ -432,7 +583,7 @@ bool Actor::tick(bool forceDraw) {  			if (walked) {  				_vm->_actors[_id]->changeAnimationMode(0); -				this->processMovement(); +				this->movementTrackWaypointReached();  				if (this->inCombat()) {  					this->changeAnimationMode(this->_combatAnimationMode, false);  				} else { @@ -613,6 +764,10 @@ bool Actor::isWalking() {  	return _walkInfo->isWalking();  } +bool Actor::isRunning() { +	return _walkInfo->isRunning(); +} +  void Actor::stopWalking(bool value) {  	if (value && _id == 0) {  		_vm->_playerActorIdle = true; @@ -927,69 +1082,6 @@ int Actor::soundBalance() {  	return 127.0f * (MAX(MIN(screenPosition.x / 640.0f, 1.0f), 0.0f) * 2.0f - 1.0f);  } -void Actor::countdownTimerStart(int timerId, int interval) { -	assert(timerId >= 0 && timerId < 7); -	_timersRemain[timerId] = interval; -	_timersStart[timerId] = _vm->getTotalPlayTime(); -} - -void Actor::countdownTimerReset(int timerId) { -	assert(timerId >= 0 && timerId < 7); -	_timersRemain[timerId] = 0; -} - -int Actor::countdownTimerGetRemainingTime(int timerId) { -	assert(timerId >= 0 && timerId < 7); -	return _timersRemain[timerId]; -} - -void Actor::countdownTimersUpdate() { -	for (int i = 0; i <= 6; i++) { -		countdownTimerUpdate(i); -	} -} - -void Actor::countdownTimerUpdate(int timerId) { -	if (_timersRemain[timerId] == 0) -		return; - -	uint32 now = _vm->getTotalPlayTime(); -	int tickInterval = now - _timersStart[timerId]; -	_timersStart[timerId] = now; - -	// warning("tickInterval: %d", tickInterval); -	_timersRemain[timerId] -= tickInterval; - -	if (_timersRemain[timerId] <= 0) { -		switch (timerId) { -		case 0: -		case 1: -		case 2: -			if (!_vm->_aiScripts->IsInsideScript() && !_vm->_script->IsInsideScript()) { -				_vm->_aiScripts->TimerExpired(this->_id, timerId); -				this->_timersRemain[timerId] = 0; -				//return false; -			} else { -				this->_timersRemain[timerId] = 1; -				//return true; -			} -			break; -		case 3: -			// Movement track timer -			break; -		case 4: -			// Something timer -			break; -		case 5: -			// Actor animation frame timer -			break; -		case 6: -			// Slow down actor run timer? -			break; -		} -	} -} -  bool Actor::walkFindU1(const Vector3 &startPosition, const Vector3 &targetPosition, float size, Vector3 *newDestination) {  	newDestination->x = 0.0f;  	newDestination->y = 0.0f; diff --git a/engines/bladerunner/actor.h b/engines/bladerunner/actor.h index a14139cf3d..d924730b4b 100644 --- a/engines/bladerunner/actor.h +++ b/engines/bladerunner/actor.h @@ -78,6 +78,16 @@ private:  	bool _isMoving;  	bool _damageAnimIfMoving; +	// Movement +	bool _movementTrackPaused; +	int _movementTrackNextWaypointId; +	int _movementTrackNextDelay; // probably not used +	int _movementTrackNextAngle; // probably not used +	bool _movementTrackNextRunning; + +	int _movementTrackWalkingToWaypointId; +	int _movementTrackDelayOnNextWaypoint; +  	// Animation  	int _width;  	int _height; @@ -122,7 +132,16 @@ public:  	void changeAnimationMode(int animationMode, bool force = false);  	void setFPS(int fps); -	void processMovement(); +	void countdownTimerStart(int timerId, int interval); +	void countdownTimerReset(int timerId); +	int  countdownTimerGetRemainingTime(int timerId); +	void countdownTimersUpdate(); +	void countdownTimerUpdate(int timerId); + +	void movementTrackNext(bool omitAiScript); +	void movementTrackPause(); +	void movementTrackUnpause(); +	void movementTrackWaypointReached();  	bool loopWalkToActor(int otherActorId, int destinationOffset, int a3, bool run, bool a5, bool *isRunning);  	bool loopWalkToItem(int itemId, int destinationOffset, int a3, bool run, bool a5, bool *isRunning); @@ -133,12 +152,6 @@ public:  	bool tick(bool forceUpdate);  	void draw(); -	void countdownTimerStart(int timerId, int interval); -	void countdownTimerReset(int timerId); -	int  countdownTimerGetRemainingTime(int timerId); -	void countdownTimersUpdate(); -	void countdownTimerUpdate(int timerId); -  	int getSetId();  	void setSetId(int setId);  	BoundingBox *getBoundingBox() { return _bbox; } @@ -152,6 +165,7 @@ public:  	bool isMoving() { return _isMoving; }  	void setMoving(bool value) { _isMoving = value; }  	bool isWalking(); +	bool isRunning();  	void stopWalking(bool value);  	void faceActor(int otherActorId, bool animate); diff --git a/engines/bladerunner/bladerunner.cpp b/engines/bladerunner/bladerunner.cpp index b2f7abc744..6a06422a24 100644 --- a/engines/bladerunner/bladerunner.cpp +++ b/engines/bladerunner/bladerunner.cpp @@ -488,6 +488,9 @@ void BladeRunnerEngine::shutdown() {  		delete _actors[i];  		_actors[i] = nullptr;  	} +	delete _actors[VOICEOVER_ACTOR]; +	_actors[VOICEOVER_ACTOR] = nullptr; +  	_playerActor = nullptr;  	// TODO: Delete proper ZBuf class diff --git a/engines/bladerunner/movement_track.cpp b/engines/bladerunner/movement_track.cpp index bd74116566..702a1187f1 100644 --- a/engines/bladerunner/movement_track.cpp +++ b/engines/bladerunner/movement_track.cpp @@ -34,9 +34,9 @@ MovementTrack::~MovementTrack() {  void MovementTrack::reset() {  	_currentIndex = -1; -	_lastIndex = -1; -	_hasNext = 0; -	_paused = 0; +	_lastIndex = 0; +	_hasNext = false; +	_paused = false;  	for (int i = 0; i < 100; i++) {  		_entries[i].waypointId = -1;  		_entries[i].delay = -1; @@ -49,9 +49,10 @@ int MovementTrack::append(int waypointId, int delay, int running) {  	return append(waypointId, delay, -1, running);  } -int MovementTrack::append(int waypointId, int delay, int angle, int running) { -	if (_lastIndex >= ARRAYSIZE(_entries)) +int MovementTrack::append(int waypointId, int delay, int angle, int running) {	 +	if (_lastIndex >= 100) {  		return 0; +	}  	_entries[_lastIndex].waypointId = waypointId;  	_entries[_lastIndex].delay = delay; @@ -59,7 +60,7 @@ int MovementTrack::append(int waypointId, int delay, int angle, int running) {  	_entries[_lastIndex].running = running;  	_lastIndex++; -	_hasNext = 1; +	_hasNext = true;  	_currentIndex = 0;  	return 1;  } @@ -70,42 +71,39 @@ void MovementTrack::flush() {  void MovementTrack::repeat() {  	_currentIndex = 0; -	_hasNext = 1; +	_hasNext = true;  } -int MovementTrack::pause() { -	_paused = 1; -	return 1; +void MovementTrack::pause() { +	_paused = true;  } -int MovementTrack::unpause() { -	_paused = 0; -	return 1; +void MovementTrack::unpause() { +	_paused = false;  } -int MovementTrack::isPaused() { +bool MovementTrack::isPaused() {  	return _paused;  } -int MovementTrack::hasNext() { +bool MovementTrack::hasNext() {  	return _hasNext;  } -int MovementTrack::next(int *waypointId, int *delay, int *angle, int *running) { -	if (_currentIndex < _lastIndex && this->_hasNext) -	{ +bool MovementTrack::next(int *waypointId, int *delay, int *angle, int *running) { +	if (_currentIndex < _lastIndex && _hasNext) {  		*waypointId = _entries[_currentIndex].waypointId;  		*delay = _entries[_currentIndex].delay;  		*angle = _entries[_currentIndex].angle;  		*running = _entries[_currentIndex++].running; -		return 1; +		return true;  	} else {  		*waypointId = -1;  		*delay = -1;  		*angle = -1;  		*running = 0; -		_hasNext = 0; -		return 0; +		_hasNext = false; +		return false;  	}  } diff --git a/engines/bladerunner/movement_track.h b/engines/bladerunner/movement_track.h index 450592210a..bffac4855a 100644 --- a/engines/bladerunner/movement_track.h +++ b/engines/bladerunner/movement_track.h @@ -43,8 +43,8 @@ class MovementTrack {  private:  	int _currentIndex;  	int _lastIndex; -	int _hasNext; -	int _paused; +	bool _hasNext; +	bool _paused;  	MovementTrackEntry _entries[100];  	void reset(); @@ -55,11 +55,11 @@ public:  	int append(int waypointId, int delay, int angle, int running);  	void flush();  	void repeat(); -	int pause(); -	int unpause(); -	int isPaused(); -	int hasNext(); -	int next(int *waypointId, int *delay, int *angle, int *running); +	void pause(); +	void unpause(); +	bool isPaused(); +	bool hasNext(); +	bool next(int *waypointId, int *delay, int *angle, int *running);  	//int saveGame();  }; diff --git a/engines/bladerunner/script/ai_00_mccoy.cpp b/engines/bladerunner/script/ai_00_mccoy.cpp index 52f9c4009e..70f127213f 100644 --- a/engines/bladerunner/script/ai_00_mccoy.cpp +++ b/engines/bladerunner/script/ai_00_mccoy.cpp @@ -1661,7 +1661,7 @@ void AIScript_McCoy::SetAnimationState(int animationState, int a2, int a3, int a  	dword_46271C = a4;  } -bool AIScript_McCoy::ReachedMovementTrackWaypoint(int a1) { +bool AIScript_McCoy::ReachedMovementTrackWaypoint(int waypointId) {  	return true;  } diff --git a/engines/bladerunner/script/ai_15_runciter.cpp b/engines/bladerunner/script/ai_15_runciter.cpp index f4cffd834f..b26339b653 100644 --- a/engines/bladerunner/script/ai_15_runciter.cpp +++ b/engines/bladerunner/script/ai_15_runciter.cpp @@ -628,8 +628,8 @@ void AIScript_Runciter::SetAnimationState(int animationState, int animationFrame  	var_462804 = a4;  } -bool AIScript_Runciter::ReachedMovementTrackWaypoint(int a1) { -	switch (a1) { +bool AIScript_Runciter::ReachedMovementTrackWaypoint(int waypointId) { +	switch (waypointId) {  	case 93:  		Actor_Face_Heading(15, 1002, true);  		break; diff --git a/engines/bladerunner/script/ai_23_officer_leroy.cpp b/engines/bladerunner/script/ai_23_officer_leroy.cpp index daf1ea9d73..8f97466a8a 100644 --- a/engines/bladerunner/script/ai_23_officer_leroy.cpp +++ b/engines/bladerunner/script/ai_23_officer_leroy.cpp @@ -1192,8 +1192,8 @@ void AIScript_Officer_Leroy::SetAnimationState(int animationState, int animation  	var_462884 = a4;  } -bool AIScript_Officer_Leroy::ReachedMovementTrackWaypoint(int a1) { -	if (a1 == 57 || a1 == 58) { +bool AIScript_Officer_Leroy::ReachedMovementTrackWaypoint(int waypointId) { +	if (waypointId == 57 || waypointId == 58) {  		sub_431408();  		AI_Countdown_Timer_Reset(23, 2);  		AI_Countdown_Timer_Start(23, 2, 6); diff --git a/engines/bladerunner/script/script.cpp b/engines/bladerunner/script/script.cpp index 320373a058..bc6679051c 100644 --- a/engines/bladerunner/script/script.cpp +++ b/engines/bladerunner/script/script.cpp @@ -1364,26 +1364,28 @@ void ScriptBase::I_Sez(const char *str) {  }  void ScriptBase::AI_Countdown_Timer_Start(int actorId, signed int timer, int seconds) { -//	if (timer >= 0 && timer <= 2) -//		_vm->_actors[actorId]->timerSet(timer, 1000 * seconds); +	if (timer >= 0 && timer <= 2) { +		_vm->_actors[actorId]->countdownTimerStart(timer, 1000 * seconds); +	}  }  void ScriptBase::AI_Countdown_Timer_Reset(int actorId, int timer) { -//	if (timer >= 0 && timer <= 2) -//		_vm->_actors[actorId]->timerReset(timer); +	if (timer >= 0 && timer <= 2) { +		_vm->_actors[actorId]->countdownTimerReset(timer); +	}  }  void ScriptBase::AI_Movement_Track_Unpause(int actorId) { -	//_vm->_actors[actorId]->movementTrackUnpause(); +	_vm->_actors[actorId]->movementTrackUnpause();  }  void ScriptBase::AI_Movement_Track_Pause(int actorId) { -	//_vm->_actors[actorId]->movementTrackPause(); +	_vm->_actors[actorId]->movementTrackPause();  }  void ScriptBase::AI_Movement_Track_Repeat(int actorId) {  	_vm->_actors[actorId]->_movementTrack->repeat(); -	//_vm->_actors[actorId]->movementTrackRepeat(1); +	_vm->_actors[actorId]->movementTrackNext(true);  }  void ScriptBase::AI_Movement_Track_Append_Run_With_Facing(int actorId, int waypointId, int delay, int angle) { @@ -1471,8 +1473,8 @@ AIScripts::~AIScripts() {  		delete _AIScripts[i];  		_AIScripts[i] = nullptr;  	} -	delete _AIScripts; -	delete _actorUpdating; +	delete[] _AIScripts; +	delete[] _actorUpdating;  }  void AIScripts::Initialize(int actor) { @@ -1496,56 +1498,87 @@ void AIScripts::Update(int actor) {  void AIScripts::TimerExpired(int actor, int timer) {  	assert(actor < _actorsCount);  	_inScriptCounter++; -	if (_AIScripts[actor]) +	if (_AIScripts[actor]) {  		_AIScripts[actor]->TimerExpired(timer); +	}  	_inScriptCounter--;  } +void AIScripts::CompletedMovementTrack(int actor) { +	assert(actor < _actorsCount); +	if (!_vm->_actors[actor]->inCombat()) { +		_inScriptCounter++; +		if (_AIScripts[actor]) { +			_AIScripts[actor]->CompletedMovementTrack(); +		} +		_inScriptCounter--; +	} +} +  void AIScripts::EnteredScene(int actor, int setId) {  	assert(actor < _actorsCount);  	_inScriptCounter++; -	if (_AIScripts[actor]) +	if (_AIScripts[actor]) {  		_AIScripts[actor]->EnteredScene(setId); +	}  	_inScriptCounter--;  }  void AIScripts::OtherAgentEnteredThisScene(int actor, int otherActorId) {  	assert(actor < _actorsCount);  	_inScriptCounter++; -	if (_AIScripts[actor]) +	if (_AIScripts[actor]) {  		_AIScripts[actor]->OtherAgentEnteredThisScene(otherActorId); +	}  	_inScriptCounter--;  }  void AIScripts::OtherAgentExitedThisScene(int actor, int otherActorId) {  	assert(actor < _actorsCount);  	_inScriptCounter++; -	if (_AIScripts[actor]) +	if (_AIScripts[actor]) {  		_AIScripts[actor]->OtherAgentExitedThisScene(otherActorId); +	}  	_inScriptCounter--;  }  void AIScripts::GoalChanged(int actor, int currentGoalNumber, int newGoalNumber) {  	assert(actor < _actorsCount);  	_inScriptCounter++; -	if (_AIScripts[actor]) +	if (_AIScripts[actor]) {  		_AIScripts[actor]->GoalChanged(currentGoalNumber, newGoalNumber); +	}  	_inScriptCounter--;  } +bool AIScripts::ReachedMovementTrackWaypoint(int actor, int waypointId) { +	assert(actor < _actorsCount); +	bool result = false; +	if (!_vm->_actors[actor]->inCombat()) { +		_inScriptCounter++; +		if (_AIScripts[actor]) { +			result = _AIScripts[actor]->ReachedMovementTrackWaypoint(waypointId); +		} +		_inScriptCounter--; +	} +	return result; +} +  void AIScripts::UpdateAnimation(int actor, int *animation, int *frame) {  	assert(actor < _actorsCount);  	_inScriptCounter++; -	if (_AIScripts[actor]) +	if (_AIScripts[actor]) {  		_AIScripts[actor]->UpdateAnimation(animation, frame); +	}  	_inScriptCounter--;  }  void AIScripts::ChangeAnimationMode(int actor, int mode) {  	assert(actor < _actorsCount);  	_inScriptCounter++; -	if (_AIScripts[actor]) +	if (_AIScripts[actor]) {  		_AIScripts[actor]->ChangeAnimationMode(mode); +	}  	_inScriptCounter--;  } diff --git a/engines/bladerunner/script/script.h b/engines/bladerunner/script/script.h index bf787e78c4..8577078c0d 100644 --- a/engines/bladerunner/script/script.h +++ b/engines/bladerunner/script/script.h @@ -835,7 +835,7 @@ public:  	virtual bool ChangeAnimationMode(int mode) = 0;  	virtual void QueryAnimationState(int *animationState, int *a2, int *a3, int *a4) = 0;  	virtual void SetAnimationState(int animationState, int a2, int a3, int a4) = 0; -	virtual bool ReachedMovementTrackWaypoint(int a1) = 0; +	virtual bool ReachedMovementTrackWaypoint(int waypointId) = 0;  	virtual void FledCombat() = 0;  }; @@ -853,10 +853,12 @@ public:  	void Initialize(int actor);  	void Update(int actor);  	void TimerExpired(int actor, int timer); +	void CompletedMovementTrack(int actor);  	void EnteredScene(int actor, int setId);  	void OtherAgentEnteredThisScene(int actor, int otherActorId);  	void OtherAgentExitedThisScene(int actor, int otherActorId);  	void GoalChanged(int actor, int currentGoalNumber, int newGoalNumber); +	bool ReachedMovementTrackWaypoint(int actor, int waypointId);  	void UpdateAnimation(int actor, int *animation, int *frame);  	void ChangeAnimationMode(int actor, int mode);  | 
