diff options
author | Peter Kohaut | 2018-02-10 20:34:28 +0100 |
---|---|---|
committer | Peter Kohaut | 2018-02-10 21:01:15 +0100 |
commit | 0b484d51b838d740bbb1d6bc12c06c25d225c197 (patch) | |
tree | 931c42a9751703beb7694b429dc6fea023b21745 /engines/bladerunner/script/ai.cpp | |
parent | 2ac361782c585a5a0c0d11e12beeab66d651cab5 (diff) | |
download | scummvm-rg350-0b484d51b838d740bbb1d6bc12c06c25d225c197.tar.gz scummvm-rg350-0b484d51b838d740bbb1d6bc12c06c25d225c197.tar.bz2 scummvm-rg350-0b484d51b838d740bbb1d6bc12c06c25d225c197.zip |
BLADERUNNER: VK interface
Code unification
Removed few memory leaks
Diffstat (limited to 'engines/bladerunner/script/ai.cpp')
-rw-r--r-- | engines/bladerunner/script/ai.cpp | 196 |
1 files changed, 0 insertions, 196 deletions
diff --git a/engines/bladerunner/script/ai.cpp b/engines/bladerunner/script/ai.cpp deleted file mode 100644 index f61b0212a7..0000000000 --- a/engines/bladerunner/script/ai.cpp +++ /dev/null @@ -1,196 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "bladerunner/script/ai.h" - -#include "bladerunner/bladerunner.h" - -#include "bladerunner/actor.h" - -namespace BladeRunner { - -AIScripts::AIScripts(BladeRunnerEngine *vm, int actorCount) { - _vm = vm; - _inScriptCounter = 0; - _actorCount = actorCount; - _actorUpdating = new bool[actorCount]; - _AIScripts = new AIScriptBase*[actorCount]; - for (int i = 0; i < actorCount; ++i) { - _AIScripts[i] = nullptr; - _actorUpdating[i] = false; - } - - _AIScripts[kActorMcCoy] = new AIScriptMcCoy(_vm); - _AIScripts[kActorRunciter] = new AIScriptRunciter(_vm); - _AIScripts[kActorOfficerLeary] = new AIScriptOfficerLeary(_vm); - _AIScripts[kActorLeon] = new AIScriptLeon(_vm); - _AIScripts[kActorMaggie] = new AIScriptMaggie(_vm); -} - -AIScripts::~AIScripts() { - for (int i = 0; i < _actorCount; ++i) { - delete _AIScripts[i]; - _AIScripts[i] = nullptr; - } - delete[] _AIScripts; - delete[] _actorUpdating; -} - -void AIScripts::Initialize(int actor) { - assert(actor < _actorCount); - if (_AIScripts[actor]) { - _AIScripts[actor]->Initialize(); - } -} - -void AIScripts::Update(int actor) { - assert(actor < _actorCount); - if (this->_actorUpdating[actor] != 1) { - this->_actorUpdating[actor] = true; - ++this->_inScriptCounter; - if (_AIScripts[actor]) - _AIScripts[actor]->Update(); - --this->_inScriptCounter; - this->_actorUpdating[actor] = false; - } -} - -void AIScripts::TimerExpired(int actor, int timer) { - assert(actor < _actorCount); - _inScriptCounter++; - if (_AIScripts[actor]) { - _AIScripts[actor]->TimerExpired(timer); - } - _inScriptCounter--; -} - -void AIScripts::CompletedMovementTrack(int actor) { - assert(actor < _actorCount); - if (!_vm->_actors[actor]->inCombat()) { - _inScriptCounter++; - if (_AIScripts[actor]) { - _AIScripts[actor]->CompletedMovementTrack(); - } - _inScriptCounter--; - } -} - -void AIScripts::ReceivedClue(int actor, int clueId, int fromActorId) { - assert(actor < _actorCount); - _inScriptCounter++; - if (_AIScripts[actor]) { - _AIScripts[actor]->ReceivedClue(clueId, fromActorId); - } - _inScriptCounter--; -} - -void AIScripts::ClickedByPlayer(int actor) { - assert(actor < _actorCount); - - if(_vm->_actors[actor]->inCombat()) { - return; - } - - _inScriptCounter++; - if (_AIScripts[actor]) { - _AIScripts[actor]->ClickedByPlayer(); - } - _inScriptCounter--; -} - -void AIScripts::EnteredScene(int actor, int setId) { - assert(actor < _actorCount); - _inScriptCounter++; - if (_AIScripts[actor]) { - _AIScripts[actor]->EnteredScene(setId); - } - _inScriptCounter--; -} - -void AIScripts::OtherAgentEnteredThisScene(int actor, int otherActorId) { - assert(actor < _actorCount); - _inScriptCounter++; - if (_AIScripts[actor]) { - _AIScripts[actor]->OtherAgentEnteredThisScene(otherActorId); - } - _inScriptCounter--; -} - -void AIScripts::OtherAgentExitedThisScene(int actor, int otherActorId) { - assert(actor < _actorCount); - _inScriptCounter++; - if (_AIScripts[actor]) { - _AIScripts[actor]->OtherAgentExitedThisScene(otherActorId); - } - _inScriptCounter--; -} - -void AIScripts::Retired(int actor, int retiredByActorId) { - assert(actor < _actorCount); - _inScriptCounter++; - if (_AIScripts[actor]) { - _AIScripts[actor]->Retired(retiredByActorId); - } - _inScriptCounter--; -} - -void AIScripts::GoalChanged(int actor, int currentGoalNumber, int newGoalNumber) { - assert(actor < _actorCount); - _inScriptCounter++; - if (_AIScripts[actor]) { - _AIScripts[actor]->GoalChanged(currentGoalNumber, newGoalNumber); - } - _inScriptCounter--; -} - -bool AIScripts::ReachedMovementTrackWaypoint(int actor, int waypointId) { - assert(actor < _actorCount); - 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 < _actorCount); - _inScriptCounter++; - if (_AIScripts[actor]) { - _AIScripts[actor]->UpdateAnimation(animation, frame); - } - _inScriptCounter--; -} - -void AIScripts::ChangeAnimationMode(int actor, int mode) { - assert(actor < _actorCount); - _inScriptCounter++; - if (_AIScripts[actor]) { - _AIScripts[actor]->ChangeAnimationMode(mode); - } - _inScriptCounter--; -} - -} // End of namespace BladeRunner |