diff options
-rw-r--r-- | engines/bladerunner/module.mk | 1 | ||||
-rw-r--r-- | engines/bladerunner/script/ai/tyrell.cpp | 268 | ||||
-rw-r--r-- | engines/bladerunner/script/ai_script.cpp | 1 | ||||
-rw-r--r-- | engines/bladerunner/script/ai_script.h | 5 |
4 files changed, 275 insertions, 0 deletions
diff --git a/engines/bladerunner/module.mk b/engines/bladerunner/module.mk index b113864bed..5f371e7372 100644 --- a/engines/bladerunner/module.mk +++ b/engines/bladerunner/module.mk @@ -95,6 +95,7 @@ MODULE_OBJS = \ script/ai/teenager.o \ script/ai/the_bard.o \ script/ai/transient.o \ + script/ai/tyrell.o \ script/ai/tyrell_guard.o \ script/ai/zuben.o \ script/scene_script.o \ diff --git a/engines/bladerunner/script/ai/tyrell.cpp b/engines/bladerunner/script/ai/tyrell.cpp new file mode 100644 index 0000000000..90fd590f7e --- /dev/null +++ b/engines/bladerunner/script/ai/tyrell.cpp @@ -0,0 +1,268 @@ +/* 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_script.h" + +namespace BladeRunner { + +AIScriptTyrell::AIScriptTyrell(BladeRunnerEngine *vm) : AIScriptBase(vm) { + _flag = true; + _var = 0; +} + +void AIScriptTyrell::Initialize() { + _animationFrame = 0; + _animationState = 0; + _animationStateNext = 0; + _animationNext = 0; + + _flag = true; + _var = 0; + + Actor_Set_Goal_Number(kActorTyrell, 0); +} + +bool AIScriptTyrell::Update() { + if (Global_Variable_Query(kVariableChapter) > 3 && Actor_Query_Goal_Number(kActorTyrell) < 300) + Actor_Set_Goal_Number(kActorTyrell, 300); + + return false; +} + +void AIScriptTyrell::TimerExpired(int timer) { + //return false; +} + +void AIScriptTyrell::CompletedMovementTrack() { + //return false; +} + +void AIScriptTyrell::ReceivedClue(int clueId, int fromActorId) { + //return false; +} + +void AIScriptTyrell::ClickedByPlayer() { + //return false; +} + +void AIScriptTyrell::EnteredScene(int sceneId) { + // return false; +} + +void AIScriptTyrell::OtherAgentEnteredThisScene(int otherActorId) { + // return false; +} + +void AIScriptTyrell::OtherAgentExitedThisScene(int otherActorId) { + // return false; +} + +void AIScriptTyrell::OtherAgentEnteredCombatMode(int otherActorId, int combatMode) { + // return false; +} + +void AIScriptTyrell::ShotAtAndMissed() { + // return false; +} + +bool AIScriptTyrell::ShotAtAndHit() { + return false; +} + +void AIScriptTyrell::Retired(int byActorId) { + // return false; +} + +int AIScriptTyrell::GetFriendlinessModifierIfGetsClue(int otherActorId, int clueId) { + return 0; +} + +bool AIScriptTyrell::GoalChanged(int currentGoalNumber, int newGoalNumber) { + if (newGoalNumber == 300) { + Actor_Put_In_Set(kActorTyrell, kSetFreeSlotH); + Actor_Set_At_Waypoint(kActorTyrell, 40, 0); + } + + return false; +} + +bool AIScriptTyrell::UpdateAnimation(int *animation, int *frame) { + switch (_animationState) { + case 0: + if (_var == 1) { + *animation = 767; + _animationFrame++; + if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(767)) { + *animation = 766; + _animationFrame = 0; + _var = 0; + } + } else if (_var == 0) { + *animation = 766; + _animationFrame++; + if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(766)) { + _animationFrame = 0; + if (!Random_Query(0, 3)) { + _var = 1; + } + } + } + break; + + case 1: + *animation = 765; + _animationFrame++; + if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(765)) { + _animationFrame = 0; + } + break; + + case 2: + if (!_animationFrame && _flag) { + *animation = 766; + _animationState = 0; + } else { + *animation = 768; + _animationFrame++; + if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(768)) { + _animationFrame = 0; + } + } + break; + + case 3: + *animation = 769; + _animationFrame++; + if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(769)) { + _animationFrame = 0; + _animationState = 2; + *animation = 768; + } + break; + + case 4: + *animation = 770; + _animationFrame++; + if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(770)) { + _animationFrame = 0; + _animationState = 2; + *animation = 768; + } + break; + + case 5: + *animation = 771; + _animationFrame++; + if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(771)) { + _animationFrame = 0; + _animationState = 2; + *animation = 768; + } + break; + + case 6: + *animation = 772; + _animationFrame++; + if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(772)) { + _animationFrame = 0; + _animationState = 2; + *animation = 768; + } + break; + + default: + break; + } + *frame = _animationFrame; + + return true; +} + +bool AIScriptTyrell::ChangeAnimationMode(int mode) { + switch (mode) { + case 0: + if (_animationState >= 2 && _animationState <= 6) { + _flag = 1; + } else { + _animationState = 0; + _animationFrame = 0; + } + break; + case 1: + _animationState = 1; + _animationFrame = 0; + break; + case 3: + _animationState = 2; + _animationFrame = 0; + _flag = 0; + break; + case 12: + _animationState = 3; + _animationFrame = 0; + _flag = 0; + break; + case 13: + _animationState = 4; + _animationFrame = 0; + _flag = 0; + break; + case 14: + _animationState = 5; + _animationFrame = 0; + _flag = 0; + break; + case 15: + _animationState = 6; + _animationFrame = 0; + _flag = 0; + break; + default: + break; + } + + return true; +} + +void AIScriptTyrell::QueryAnimationState(int *animationState, int *animationFrame, int *animationStateNext, int *animationNext) { + *animationState = _animationState; + *animationFrame = _animationFrame; + *animationStateNext = _animationStateNext; + *animationNext = _animationNext; +} + +void AIScriptTyrell::SetAnimationState(int animationState, int animationFrame, int animationStateNext, int animationNext) { + _animationState = animationState; + _animationFrame = animationFrame; + _animationStateNext = animationStateNext; + _animationNext = animationNext; +} + +bool AIScriptTyrell::ReachedMovementTrackWaypoint(int waypointId) { + return true; +} + +void AIScriptTyrell::FledCombat() { + // return false; +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ai_script.cpp b/engines/bladerunner/script/ai_script.cpp index f193e45d00..2b661736b4 100644 --- a/engines/bladerunner/script/ai_script.cpp +++ b/engines/bladerunner/script/ai_script.cpp @@ -77,6 +77,7 @@ AIScripts::AIScripts(BladeRunnerEngine *vm, int actorCount) { _AIScripts[kActorHysteriaPatron2] = new AIScriptHysteriaPatron2(_vm); // 48 _AIScripts[kActorHysteriaPatron3] = new AIScriptHysteriaPatron3(_vm); // 49 _AIScripts[kActorShoeshineMan] = new AIScriptShoeshineMan(_vm); // 50 + _AIScripts[kActorTyrell] = new AIScriptTyrell(_vm); // 51 _AIScripts[kActorGaff] = new AIScriptGaff(_vm); // 53 _AIScripts[kActorBryant] = new AIScriptBryant(_vm); // 54 _AIScripts[kActorNewscaster] = new AIScriptNewscaster(_vm); // 61 diff --git a/engines/bladerunner/script/ai_script.h b/engines/bladerunner/script/ai_script.h index 7915b664f6..425951c89a 100644 --- a/engines/bladerunner/script/ai_script.h +++ b/engines/bladerunner/script/ai_script.h @@ -297,6 +297,11 @@ DECLARE_SCRIPT(ShoeshineMan) bool _state; END_SCRIPT +DECLARE_SCRIPT(Tyrell) + bool _flag; + int _var; +END_SCRIPT + DECLARE_SCRIPT(Gaff) END_SCRIPT |