From 11e5e5d378819ca2d5e000b7daf383492699ffa0 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 13 Mar 2018 15:08:44 +0100 Subject: BLADERUNNER: Added Isabella actor --- engines/bladerunner/module.mk | 1 + engines/bladerunner/script/ai/chew.cpp | 2 +- engines/bladerunner/script/ai/isabella.cpp | 466 +++++++++++++++++++++++++++++ engines/bladerunner/script/ai_script.cpp | 1 + engines/bladerunner/script/ai_script.h | 7 + 5 files changed, 476 insertions(+), 1 deletion(-) create mode 100644 engines/bladerunner/script/ai/isabella.cpp diff --git a/engines/bladerunner/module.mk b/engines/bladerunner/module.mk index c69795da97..0475505309 100644 --- a/engines/bladerunner/module.mk +++ b/engines/bladerunner/module.mk @@ -75,6 +75,7 @@ MODULE_OBJS = \ script/ai/hysteria_patron2.o \ script/ai/hysteria_patron3.o \ script/ai/insect_dealer.o \ + script/ai/isabella.o \ script/ai/klein.o \ script/ai/lance.o \ script/ai/leon.o \ diff --git a/engines/bladerunner/script/ai/chew.cpp b/engines/bladerunner/script/ai/chew.cpp index b732de2a53..65403920b7 100644 --- a/engines/bladerunner/script/ai/chew.cpp +++ b/engines/bladerunner/script/ai/chew.cpp @@ -164,7 +164,7 @@ bool AIScriptChew::UpdateAnimation(int *animation, int *frame) { if (_var2 == 2) { *animation = 779; } - if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(*animation)) { + if (_animationFrame < Slice_Animation_Query_Number_Of_Frames(*animation)) { _animationFrame += 2; if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(*animation)) { _animationFrame = 0; diff --git a/engines/bladerunner/script/ai/isabella.cpp b/engines/bladerunner/script/ai/isabella.cpp new file mode 100644 index 0000000000..307806f76b --- /dev/null +++ b/engines/bladerunner/script/ai/isabella.cpp @@ -0,0 +1,466 @@ +/* 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 { + +AIScriptIsabella::AIScriptIsabella(BladeRunnerEngine *vm) : AIScriptBase(vm) { + _var1 = 0; + _var2 = 0; + _var3 = 0; + _var4 = 1; +} + +void AIScriptIsabella::Initialize() { + _animationFrame = 0; + _animationState = 0; + _animationStateNext = 0; + _animationNext = 0; + + _var1 = 0; + _var2 = 0; + _var3 = 0; + _var4 = 1; +} + +bool AIScriptIsabella::Update() { + return false; +} + +void AIScriptIsabella::TimerExpired(int timer) { + //return false; +} + +void AIScriptIsabella::CompletedMovementTrack() { + //return false; +} + +void AIScriptIsabella::ReceivedClue(int clueId, int fromActorId) { + //return false; +} + +void AIScriptIsabella::ClickedByPlayer() { + //return false; +} + +void AIScriptIsabella::EnteredScene(int sceneId) { + // return false; +} + +void AIScriptIsabella::OtherAgentEnteredThisScene(int otherActorId) { + // return false; +} + +void AIScriptIsabella::OtherAgentExitedThisScene(int otherActorId) { + // return false; +} + +void AIScriptIsabella::OtherAgentEnteredCombatMode(int otherActorId, int combatMode) { + // return false; +} + +void AIScriptIsabella::ShotAtAndMissed() { + // return false; +} + +bool AIScriptIsabella::ShotAtAndHit() { + return false; +} + +void AIScriptIsabella::Retired(int byActorId) { + // return false; +} + +int AIScriptIsabella::GetFriendlinessModifierIfGetsClue(int otherActorId, int clueId) { + return 0; +} + +bool AIScriptIsabella::GoalChanged(int currentGoalNumber, int newGoalNumber) { + return false; +} + +bool AIScriptIsabella::UpdateAnimation(int *animation, int *frame) { + bool flag; + + switch (_animationState) { + case 0: + if (_var3 == 1) { + *animation = 839; + _animationFrame++; + if (_animationFrame > Slice_Animation_Query_Number_Of_Frames(839) - 1) { + _animationFrame = 0; + } + if (_animationFrame < 0) { + _animationFrame = Slice_Animation_Query_Number_Of_Frames(839) - 1; + } + if (!_animationFrame) { + _var3 = 0; + _var4 = 2 * Random_Query(0, 1) - 1; + } + } else if (_var3 == 0) { + *animation = 838; + if (_var2) { + _var2--; + if (_var2 == 0) { + _var4 = 2 * Random_Query(0, 1) - 1; + } + } else { + _animationFrame += _var4; + if (_animationFrame > Slice_Animation_Query_Number_Of_Frames(838) - 1) { + _animationFrame = 0; + } + if (_animationFrame < 0) { + _animationFrame = Slice_Animation_Query_Number_Of_Frames(838) - 1; + } + if (_animationFrame == 1) { + if (!Random_Query(0, 1)) { + _var2 = Random_Query(4, 8); + } + } + if (_animationFrame == 11) { + if (!Random_Query(0, 1)) { + _var2 = Random_Query(4, 8); + } + } + if (_animationFrame == 16) { + if (!Random_Query(0, 1)) { + _var2 = Random_Query(4, 8); + } + } + if (!_animationFrame) { + if (!Random_Query(0, 2)) { + _var3 = 1; + } + } + } + } + break; + + case 1: + *animation = 840; + _animationFrame++; + if (_animationFrame > Slice_Animation_Query_Number_Of_Frames(840) - 1) { + flag = true; + _animationFrame = 0; + } else { + if (_animationFrame < 0) { + _animationFrame = Slice_Animation_Query_Number_Of_Frames(840) - 1; + flag = true; + } else { + flag = false; + } + } + if (flag) { + *animation = 838; + _animationState = 0; + } + break; + + case 2: + *animation = 841; + if (_animationFrame < 2 && _var1) { + _animationFrame = 0; + _animationState = 0; + } else { + _animationFrame++; + if (_animationFrame > Slice_Animation_Query_Number_Of_Frames(841) - 1) { + _animationFrame = 0; + } else { + if (_animationFrame < 0) { + _animationFrame = Slice_Animation_Query_Number_Of_Frames(841) - 1; + } + } + if (!_animationFrame) { + _animationState = Random_Query(2, 3); + } + } + break; + + case 3: + *animation = 842; + if (_animationFrame < 2 && _var1) { + _animationFrame = 0; + _animationState = 0; + } else { + _animationFrame++; + if (_animationFrame > Slice_Animation_Query_Number_Of_Frames(842) - 1) { + _animationFrame = 0; + } else { + if (_animationFrame < 0) { + _animationFrame = Slice_Animation_Query_Number_Of_Frames(842) - 1; + } + } + if (!_animationFrame) { + *animation = 841; + _animationState = 2; + } + } + break; + + case 4: + *animation = 843; + _animationFrame++; + if (_animationFrame > Slice_Animation_Query_Number_Of_Frames(843) - 1) { + flag = true; + _animationFrame = 0; + } else { + if (_animationFrame < 0) { + _animationFrame = Slice_Animation_Query_Number_Of_Frames(843) - 1; + flag = true; + } else { + flag = false; + } + } + if (flag) { + *animation = 841; + _animationState = 2; + } + break; + + case 5: + *animation = 844; + _animationFrame++; + if (_animationFrame > Slice_Animation_Query_Number_Of_Frames(844) - 1) { + flag = true; + _animationFrame = 0; + } else { + if (_animationFrame < 0) { + _animationFrame = Slice_Animation_Query_Number_Of_Frames(844) - 1; + flag = true; + } else { + flag = false; + } + } + if (flag) { + *animation = 841; + _animationState = 2; + } + break; + + case 6: + *animation = 845; + _animationFrame++; + if (_animationFrame > Slice_Animation_Query_Number_Of_Frames(845) - 1) { + flag = true; + _animationFrame = 0; + } else { + if (_animationFrame < 0) { + _animationFrame = Slice_Animation_Query_Number_Of_Frames(845) - 1; + flag = true; + } else { + flag = false; + } + } + if (flag) { + *animation = 841; + _animationState = 2; + } + break; + + case 7: + *animation = 845; + _animationFrame++; + if (_animationFrame > Slice_Animation_Query_Number_Of_Frames(845) - 1) { + flag = true; + _animationFrame = 0; + } else { + if (_animationFrame < 0) { + _animationFrame = Slice_Animation_Query_Number_Of_Frames(845) - 1; + flag = true; + } else { + flag = false; + } + } + if (flag) { + *animation = 841; + _animationState = 2; + } + break; + + case 8: + *animation = 844; + _animationFrame++; + if (_animationFrame > Slice_Animation_Query_Number_Of_Frames(844) - 1) { + flag = true; + _animationFrame = 0; + } else { + if (_animationFrame < 0) { + _animationFrame = Slice_Animation_Query_Number_Of_Frames(844) - 1; + flag = true; + } else { + flag = false; + } + } + if (flag) { + *animation = 841; + _animationState = 2; + } + break; + + case 9: + if (!_var3) { + *animation = 838; + } + if (_var3 == 1) { + *animation = 839; + } + if (_animationFrame < Slice_Animation_Query_Number_Of_Frames(*animation)) { + _animationFrame += 2; + if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(*animation)) { + _animationFrame = 0; + *animation = _animationNext; + _animationState = _animationStateNext; + } + } else { + _animationFrame -= 2; + if (_animationFrame <= 0) { + _animationFrame = 0; + *animation = _animationNext; + _animationState = _animationStateNext; + } + } + break; + + default: + break; + } + + int frames = Slice_Animation_Query_Number_Of_Frames(*animation); + + if (frames != -1) + _animationFrame %= frames; + else + _animationFrame = 0; + + *frame = _animationFrame; + + return true; +} + +bool AIScriptIsabella::ChangeAnimationMode(int mode) { + switch (mode) { + case 0: + if (_animationState > 8) { + _animationState = 0; + _animationFrame = 0; + } else { + _var1 = 1; + } + break; + + case 3: + case 9: + if (_animationState < 2 || _animationState > 8) { + _animationState = 9; + _animationStateNext = 2; + _animationNext = 841; + _var1 = 0; + } + break; + + case 10: + case 12: + if (_animationState < 2 || _animationState > 8) { + _animationState = 9; + _animationStateNext = 3; + _animationNext = 842; + _var1 = 0; + } + break; + + case 11: + case 14: + if (_animationState < 2 || _animationState > 8) { + _animationState = 9; + _animationStateNext = 5; + _animationNext = 844; + _var1 = 0; + } + break; + + case 13: + if (_animationState < 2 || _animationState > 8) { + _animationState = 9; + _animationStateNext = 4; + _animationNext = 843; + _var1 = 0; + } + break; + + case 15: + if (_animationState < 2 || _animationState > 8) { + _animationState = 9; + _animationStateNext = 6; + _animationNext = 845; + _var1 = 0; + } + break; + + case 16: + if (_animationState < 2 || _animationState > 8) { + _animationState = 9; + _animationStateNext = 7; + _animationNext = 845; + _var1 = 0; + } + break; + + case 17: + if (_animationState < 2 || _animationState > 8) { + _animationState = 9; + _animationStateNext = 8; + _animationNext = 844; + _var1 = 0; + } + break; + + default: + break; + } + + return true; +} + +void AIScriptIsabella::QueryAnimationState(int *animationState, int *animationFrame, int *animationStateNext, int *animationNext) { + *animationState = _animationState; + *animationFrame = _animationFrame; + *animationStateNext = _animationStateNext; + *animationNext = _animationNext; +} + +void AIScriptIsabella::SetAnimationState(int animationState, int animationFrame, int animationStateNext, int animationNext) { + _animationState = animationState; + _animationFrame = animationFrame; + _animationStateNext = animationStateNext; + _animationNext = animationNext; +} + +bool AIScriptIsabella::ReachedMovementTrackWaypoint(int waypointId) { + return true; +} + +void AIScriptIsabella::FledCombat() { + // return false; +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ai_script.cpp b/engines/bladerunner/script/ai_script.cpp index 303d1809da..c86f673679 100644 --- a/engines/bladerunner/script/ai_script.cpp +++ b/engines/bladerunner/script/ai_script.cpp @@ -84,6 +84,7 @@ AIScripts::AIScripts(BladeRunnerEngine *vm, int actorCount) { _AIScripts[kActorTaffy] = new AIScriptTaffy(_vm); // 55 _AIScripts[kActorSebastian] = new AIScriptSebastian(_vm); // 56 _AIScripts[kActorRachael] = new AIScriptRachael(_vm); // 57 + _AIScripts[kActorIsabella] = new AIScriptIsabella(_vm); // 59 _AIScripts[kActorBlimpGuy] = new AIScriptBlimpGuy(_vm); // 60 _AIScripts[kActorNewscaster] = new AIScriptNewscaster(_vm); // 61 _AIScripts[kActorLeon] = new AIScriptLeon(_vm); // 62 diff --git a/engines/bladerunner/script/ai_script.h b/engines/bladerunner/script/ai_script.h index 5117de2f61..11870cd0df 100644 --- a/engines/bladerunner/script/ai_script.h +++ b/engines/bladerunner/script/ai_script.h @@ -334,6 +334,13 @@ DECLARE_SCRIPT(Rachael) void dialogue_agenda3(); END_SCRIPT +DECLARE_SCRIPT(Isabella) + int _var1; + int _var2; + int _var3; + int _var4; +END_SCRIPT + DECLARE_SCRIPT(BlimpGuy) END_SCRIPT -- cgit v1.2.3