diff options
Diffstat (limited to 'engines/bladerunner/script')
-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 |
5 files changed, 57 insertions, 22 deletions
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); |