diff options
author | Eugene Sandulenko | 2018-03-16 20:12:48 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2018-03-16 21:31:33 +0100 |
commit | 041a22577adb027a87d3f7e6886df2fa17a85cbe (patch) | |
tree | bc88f3fb8506f8b077e7236c64c3d36e651c5205 /engines/bladerunner/script | |
parent | 56b3ac20e007d20c87eb901c0e15c7e7c6c55215 (diff) | |
download | scummvm-rg350-041a22577adb027a87d3f7e6886df2fa17a85cbe.tar.gz scummvm-rg350-041a22577adb027a87d3f7e6886df2fa17a85cbe.tar.bz2 scummvm-rg350-041a22577adb027a87d3f7e6886df2fa17a85cbe.zip |
BLADERUNNER: Added Mutant1 actor
Diffstat (limited to 'engines/bladerunner/script')
-rw-r--r-- | engines/bladerunner/script/ai/mutant1.cpp | 624 | ||||
-rw-r--r-- | engines/bladerunner/script/ai_script.cpp | 1 | ||||
-rw-r--r-- | engines/bladerunner/script/ai_script.h | 4 |
3 files changed, 629 insertions, 0 deletions
diff --git a/engines/bladerunner/script/ai/mutant1.cpp b/engines/bladerunner/script/ai/mutant1.cpp new file mode 100644 index 0000000000..ec8b7eaf33 --- /dev/null +++ b/engines/bladerunner/script/ai/mutant1.cpp @@ -0,0 +1,624 @@ +/* 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 { + +AIScriptMutant1::AIScriptMutant1(BladeRunnerEngine *vm) : AIScriptBase(vm) { + _flag = false; +} + +void AIScriptMutant1::Initialize() { + _animationFrame = 0; + _animationState = 0; + _animationStateNext = 0; + _animationNext = 0; + + _flag = 0; + + Actor_Put_In_Set(kActorMutant1, kSetFreeSlotG); + Actor_Set_At_Waypoint(kActorMutant1, 39, 0); + Actor_Set_Goal_Number(kActorMutant1, 400); +} + +bool AIScriptMutant1::Update() { + if (Global_Variable_Query(kVariableChapter) == 5 && Actor_Query_Goal_Number(kActorMutant1) != 590) { + if (Actor_Query_Which_Set_In(kActorMutant1) != Player_Query_Current_Set()) { + Actor_Set_Goal_Number(kActorMutant1, 590); + } + + return false; + } + + if (Global_Variable_Query(kVariableChapter) != 4) { + return false; + } + + switch (Actor_Query_Goal_Number(kActorMutant1)) { + case 400: + if (!Game_Flag_Query(523) && Game_Flag_Query(524) == 1) { + Actor_Set_Goal_Number(kActorMutant1, 401); + Actor_Set_Goal_Number(kActorMutant2, 401); + Actor_Set_Goal_Number(kActorMutant3, 401); + Actor_Set_Targetable(kActorMutant1, 1); + Actor_Set_Targetable(kActorMutant2, 1); + Actor_Set_Targetable(kActorMutant3, 1); + Game_Flag_Set(523); + } + break; + + case 401: + if (Actor_Query_Which_Set_In(kActorMutant1) == Player_Query_Current_Set() + && (Actor_Query_Friendliness_To_Other(kActorMutant1, kActorMcCoy) < 30 + || Actor_Query_Combat_Aggressiveness(70) >= 60)) { + Actor_Set_Goal_Number(kActorMutant1, 410); + } + break; + + case 404: + if (!Game_Flag_Query(630)) { + Actor_Set_Goal_Number(kActorMutant1, 403); + } + break; + + case 410: + if (Actor_Query_Which_Set_In(kActorMutant1) != Player_Query_Current_Set()) { + Non_Player_Actor_Combat_Mode_Off(70); + Actor_Set_Goal_Number(kActorMutant1, 403); + } + break; + + case 599: + if (Actor_Query_Which_Set_In(kActorMutant1) != Player_Query_Current_Set()) { + Actor_Set_Goal_Number(kActorMutant1, 411); + } + break; + } + + if (Game_Flag_Query(630) == 1 && Actor_Query_Goal_Number(kActorMutant1) != 599) { + Actor_Set_Goal_Number(kActorMutant1, 404); + } + + return false; +} + +void AIScriptMutant1::TimerExpired(int timer) { + //return false; +} + +void AIScriptMutant1::CompletedMovementTrack() { + if (Actor_Query_Goal_Number(kActorMutant1) == 401) + Actor_Set_Goal_Number(kActorMutant1, 403); +} + +void AIScriptMutant1::ReceivedClue(int clueId, int fromActorId) { + //return false; +} + +void AIScriptMutant1::ClickedByPlayer() { + //return false; +} + +void AIScriptMutant1::EnteredScene(int sceneId) { + // return false; +} + +void AIScriptMutant1::OtherAgentEnteredThisScene(int otherActorId) { + // return false; +} + +void AIScriptMutant1::OtherAgentExitedThisScene(int otherActorId) { + // return false; +} + +void AIScriptMutant1::OtherAgentEnteredCombatMode(int otherActorId, int combatMode) { + if (Actor_Query_Which_Set_In(kActorMutant1) == Player_Query_Current_Set() && Actor_Query_Goal_Number(kActorMutant1) != 599) { + if (otherActorId != kActorMcCoy) { + if (otherActorId > 72 || (otherActorId != kActorFreeSlotA && otherActorId != kActorMutant2 && otherActorId != kActorMutant3)) { + Actor_Modify_Combat_Aggressiveness(70, -10); + } else { + Actor_Modify_Combat_Aggressiveness(70, 10); + } + } else if (combatMode) { + Actor_Modify_Combat_Aggressiveness(70, 10); + } else { + Actor_Modify_Combat_Aggressiveness(70, -10); + } + } +} + +void AIScriptMutant1::ShotAtAndMissed() { + if (Actor_Query_Goal_Number(kActorMutant1) != 410) { + Actor_Modify_Combat_Aggressiveness(70, 10); + Actor_Modify_Friendliness_To_Other(kActorMutant1, kActorMcCoy, -10); + } +} + +bool AIScriptMutant1::ShotAtAndHit() { + if (Actor_Query_Goal_Number(kActorMutant1) != 410) { + Actor_Modify_Combat_Aggressiveness(70, 10); + Actor_Modify_Friendliness_To_Other(kActorMutant1, kActorMcCoy, -10); + } + + return false; +} + +void AIScriptMutant1::Retired(int byActorId) { + Actor_Set_Goal_Number(kActorMutant1, 599); +} + +int AIScriptMutant1::GetFriendlinessModifierIfGetsClue(int otherActorId, int clueId) { + return 0; +} + +bool AIScriptMutant1::GoalChanged(int currentGoalNumber, int newGoalNumber) { + switch (newGoalNumber) { + case 400: + AI_Movement_Track_Flush(kActorMutant1); + AI_Movement_Track_Append(kActorMutant1, 39, 0); + AI_Movement_Track_Repeat(kActorMutant1); + + if (Game_Flag_Query(169) == 1) { + Actor_Set_Combat_Aggressiveness(kActorMutant1, 70); + Actor_Set_Friendliness_To_Other(kActorMutant1, kActorMcCoy, 20); + } + return true; + + case 401: + Actor_Set_Targetable(kActorMutant1, 1); + AI_Movement_Track_Flush(kActorMutant1); + AI_Movement_Track_Append(kActorMutant1, 39, 0); + + switch (Random_Query(1, 8)) { + case 1: + AI_Movement_Track_Append(kActorMutant1, 182, 0); + AI_Movement_Track_Append(kActorMutant1, 183, 2); + AI_Movement_Track_Append(kActorMutant1, 184, 0); + AI_Movement_Track_Repeat(kActorMutant1); + break; + + case 2: + AI_Movement_Track_Append(kActorMutant1, 296, 0); + AI_Movement_Track_Append(kActorMutant1, 297, 0); + AI_Movement_Track_Repeat(kActorMutant1); + break; + + case 3: + AI_Movement_Track_Append(kActorMutant1, 176, 0); + AI_Movement_Track_Append(kActorMutant1, 177, 0); + AI_Movement_Track_Append(kActorMutant1, 178, 2); + AI_Movement_Track_Append(kActorMutant1, 177, 0); + AI_Movement_Track_Append(kActorMutant1, 176, 1); + AI_Movement_Track_Append(kActorMutant1, 39, 45); + AI_Movement_Track_Repeat(kActorMutant1); + break; + + case 4: + AI_Movement_Track_Append(kActorMutant1, 298, 0); + AI_Movement_Track_Append(kActorMutant1, 300, 0); + AI_Movement_Track_Repeat(kActorMutant1); + break; + + case 5: + AI_Movement_Track_Append(kActorMutant1, 301, 0); + AI_Movement_Track_Append(kActorMutant1, 302, 2); + AI_Movement_Track_Append(kActorMutant1, 303, 0); + AI_Movement_Track_Append(kActorMutant1, 304, 0); + AI_Movement_Track_Append(kActorMutant1, 305, 0); + AI_Movement_Track_Append(kActorMutant1, 304, 0); + AI_Movement_Track_Append(kActorMutant1, 306, 0); + AI_Movement_Track_Append(kActorMutant1, 39, 60); + AI_Movement_Track_Repeat(kActorMutant1); + break; + + case 6: + AI_Movement_Track_Append(kActorMutant1, 307, 0); + AI_Movement_Track_Append(kActorMutant1, 308, 0); + AI_Movement_Track_Append(kActorMutant1, 309, 1); + AI_Movement_Track_Append(kActorMutant1, 310, 3); + AI_Movement_Track_Append(kActorMutant1, 311, 0); + AI_Movement_Track_Repeat(kActorMutant1); + break; + + case 7: + switch (Random_Query(1, 5)) { + case 1: + AI_Movement_Track_Append(kActorMutant1, 532, 0); + AI_Movement_Track_Append(kActorMutant1, 533, 0); + AI_Movement_Track_Append(kActorMutant1, 534, 2); + AI_Movement_Track_Append(kActorMutant1, 535, 3); + AI_Movement_Track_Append(kActorMutant1, 533, 0); + AI_Movement_Track_Append(kActorMutant1, 532, 0); + AI_Movement_Track_Repeat(kActorMutant1); + break; + + case 2: + AI_Movement_Track_Append(kActorMutant1, 532, 0); + AI_Movement_Track_Append(kActorMutant1, 533, 0); + AI_Movement_Track_Append(kActorMutant1, 535, 2); + AI_Movement_Track_Append(kActorMutant1, 534, 3); + AI_Movement_Track_Append(kActorMutant1, 533, 0); + AI_Movement_Track_Append(kActorMutant1, 532, 0); + AI_Movement_Track_Repeat(kActorMutant1); + break; + + case 3: + AI_Movement_Track_Append(kActorMutant1, 536, 0); + AI_Movement_Track_Append(kActorMutant1, 537, 0); + AI_Movement_Track_Append(kActorMutant1, 538, 2); + AI_Movement_Track_Append(kActorMutant1, 537, 0); + AI_Movement_Track_Append(kActorMutant1, 536, 0); + AI_Movement_Track_Repeat(kActorMutant1); + break; + + case 4: + AI_Movement_Track_Append(kActorMutant1, 532, 0); + AI_Movement_Track_Append(kActorMutant1, 533, 0); + AI_Movement_Track_Append(kActorMutant1, 534, 3); + AI_Movement_Track_Append(kActorMutant1, 533, 0); + AI_Movement_Track_Append(kActorMutant1, 532, 0); + AI_Movement_Track_Repeat(kActorMutant1); + break; + + case 5: + AI_Movement_Track_Append(kActorMutant1, 532, 0); + AI_Movement_Track_Append(kActorMutant1, 533, 0); + AI_Movement_Track_Append(kActorMutant1, 535, 1); + AI_Movement_Track_Append(kActorMutant1, 533, 0); + AI_Movement_Track_Append(kActorMutant1, 532, 0); + AI_Movement_Track_Repeat(kActorMutant1); + break; + + default: + return true; + } + break; + + case 8: + if (Game_Flag_Query(623) == 1) { + AI_Movement_Track_Append(kActorMutant1, 418, 0); + AI_Movement_Track_Append(kActorMutant1, 417, 0); + AI_Movement_Track_Append(kActorMutant1, 539, 0); + AI_Movement_Track_Repeat(kActorMutant1); + } else { + Actor_Set_Goal_Number(kActorMutant1, 403); + } + break; + + default: + AI_Movement_Track_Append(kActorMutant1, 39, 60); + AI_Movement_Track_Repeat(kActorMutant1); + break; + } + return true; + + case 403: + Actor_Set_Targetable(kActorMutant1, 0); + Actor_Set_Goal_Number(kActorMutant1, 401); + return true; + + case 404: + AI_Movement_Track_Flush(kActorMutant1); + AI_Movement_Track_Append(kActorMutant1, 39, 0); + AI_Movement_Track_Repeat(kActorMutant1); + return true; + + case 410: + switch (Actor_Query_Which_Set_In(kActorMutant1)) { + case 74: + Non_Player_Actor_Combat_Mode_On(kActorMutant1, 0, 0, 0, 11, 4, 7, 8, -1, -1, -1, 10, 300, 0); + break; + + case 75: + case 76: + case 81: + case 82: + case 85: + return true; + + case 77: + case 78: + case 79: + Non_Player_Actor_Combat_Mode_On(kActorMutant1, 0, 0, 0, 10, 4, 7, 8, -1, -1, -1, 10, 300, 0); + break; + + case 80: + Non_Player_Actor_Combat_Mode_On(kActorMutant1, 0, 0, 0, 12, 4, 7, 8, -1, -1, -1, 10, 300, 0); + break; + + case 83: + Non_Player_Actor_Combat_Mode_On(kActorMutant1, 0, 0, 0, 14, 4, 7, 8, -1, -1, -1, 10, 300, 0); + break; + + case 84: + Non_Player_Actor_Combat_Mode_On(kActorMutant1, 0, 0, 0, 14, 4, 7, 8, -1, -1, -1, 10, 300, 0); + break; + + case 86: + Non_Player_Actor_Combat_Mode_On(kActorMutant1, 0, 0, 0, 14, 4, 7, 8, -1, -1, -1, 10, 300, 0); + break; + } + return true; + + case 411: + AI_Movement_Track_Flush(kActorMutant1); + Actor_Set_Intelligence(kActorMutant1, 40); + Actor_Set_Health(kActorMutant1, 10 * Query_Difficulty_Level() + 30, 10 * Query_Difficulty_Level() + 30); + + if (Game_Flag_Query(169) == 1) { + Actor_Set_Combat_Aggressiveness(kActorMutant1, 70); + Actor_Set_Friendliness_To_Other(kActorMutant1, kActorMcCoy, 20); + } else { + Actor_Set_Combat_Aggressiveness(kActorMutant1, 40); + Actor_Set_Friendliness_To_Other(kActorMutant1, kActorMcCoy, 45); + } + + Actor_Modify_Friendliness_To_Other(kActorMutant2, kActorMcCoy, -10); + Actor_Modify_Friendliness_To_Other(kActorMutant3, kActorMcCoy, -20); + Actor_Modify_Combat_Aggressiveness(kActorMutant2, 10); + Actor_Modify_Combat_Aggressiveness(kActorMutant3, 15); + Actor_Set_Goal_Number(kActorMutant1, 403); + return true; + + case 590: + AI_Movement_Track_Flush(kActorMutant1); + AI_Movement_Track_Append(kActorMutant1, 39, 100); + AI_Movement_Track_Repeat(kActorMutant1); + return true; + + case 599: + AI_Movement_Track_Flush(kActorMutant1); + Actor_Change_Animation_Mode(kActorMutant1, 48); + Actor_Modify_Friendliness_To_Other(kActorMutant2, kActorMcCoy, -10); + Actor_Modify_Friendliness_To_Other(kActorMutant3, kActorMcCoy, -20); + Actor_Modify_Combat_Aggressiveness(kActorMutant2, 10); + Actor_Modify_Combat_Aggressiveness(kActorMutant3, 15); + return true; + + default: + break; + } + + return false; +} + +bool AIScriptMutant1::UpdateAnimation(int *animation, int *frame) { + switch (_animationState) { + case 0: + *animation = 894; + _animationFrame++; + if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(894)) { + _animationFrame = 0; + } + break; + + case 1: + case 2: + *animation = 893; + _animationFrame++; + if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(893)) { + _animationFrame = 0; + } + break; + + case 3: + if (!_animationFrame && _flag) { + *animation = 894; + _animationState = 0; + } else { + *animation = 896; + _animationFrame++; + if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(896)) { + _animationFrame = 0; + } + } + break; + + case 4: + *animation = 896; + _animationFrame++; + if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(896)) { + _animationFrame = 0; + _animationState = 3; + *animation = 896; + } + break; + + case 5: + *animation = 897; + _animationFrame++; + if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(897)) { + _animationFrame = 0; + _animationState = 3; + *animation = 896; + } + break; + + case 6: + *animation = 898; + _animationFrame++; + if (_animationFrame == 5) { + int snd; + + if (Random_Query(1, 2) == 1) { + snd = 9010; + } else { + snd = 9015; + } + Sound_Play_Speech_Line(kActorMutant1, snd, 75, 0, 99); + } + if (_animationFrame == 9) { + Actor_Combat_AI_Hit_Attempt(kActorMutant1); + } + if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(898)) { + Actor_Change_Animation_Mode(kActorMutant1, 0); + } + break; + + case 7: + *animation = 899; + _animationFrame++; + if (_animationFrame == 1) { + Ambient_Sounds_Play_Sound(371, 99, 0, 0, 25); + } + if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(899)) { + Actor_Change_Animation_Mode(kActorMutant1, 0); + } + break; + + case 8: + *animation = 900; + _animationFrame++; + if (_animationFrame == 1) { + Sound_Play(368, 100, 0, 0, 50); + } + if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(900)) { + Actor_Change_Animation_Mode(kActorMutant1, 88); + } + break; + + case 9: + *animation = 900; + _animationFrame = Slice_Animation_Query_Number_Of_Frames(900) - 1; + break; + + case 10: + *animation = 899; + _animationFrame++; + if (_animationFrame == 9) { + Sound_Play(371, 100, 0, 0, 50); + } + if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(899)) { + Actor_Change_Animation_Mode(kActorMutant1, 0); + } + break; + + default: + break; + } + *frame = _animationFrame; + + return true; +} + +bool AIScriptMutant1::ChangeAnimationMode(int mode) { + switch (mode) { + case 0: + if (_animationState >= 3 && _animationState <= 5) { + _flag = 1; + } else { + _animationState = 0; + _animationFrame = 0; + } + break; + + case 1: + case 7: + _animationState = 1; + _animationFrame = 0; + break; + + case 2: + _animationState = 2; + _animationFrame = 0; + break; + + case 3: + _animationState = 3; + _animationFrame = 0; + _flag = 0; + break; + + case 4: + if (_animationState >= 3 && _animationState <= 5) { + _flag = 1; + } else { + _animationState = 0; + _animationFrame = 0; + } + break; + + case 6: + _animationState = 6; + _animationFrame = 0; + break; + + case 8: + _animationState = 2; + _animationFrame = 0; + break; + + case 12: + _animationState = 3; + _animationFrame = 0; + _flag = 0; + break; + + case 13: + _animationState = 3; + _animationFrame = 0; + _flag = 0; + break; + case 21: + case 22: + _animationState = 10; + _animationFrame = 0; + break; + + case 48: + _animationState = 8; + _animationFrame = 0; + break; + + case 88: + _animationState = 9; + _animationFrame = Slice_Animation_Query_Number_Of_Frames(900) - 1; + break; + } + + return true; +} + +void AIScriptMutant1::QueryAnimationState(int *animationState, int *animationFrame, int *animationStateNext, int *animationNext) { + *animationState = _animationState; + *animationFrame = _animationFrame; + *animationStateNext = _animationStateNext; + *animationNext = _animationNext; +} + +void AIScriptMutant1::SetAnimationState(int animationState, int animationFrame, int animationStateNext, int animationNext) { + _animationState = animationState; + _animationFrame = animationFrame; + _animationStateNext = animationStateNext; + _animationNext = animationNext; +} + +bool AIScriptMutant1::ReachedMovementTrackWaypoint(int waypointId) { + return true; +} + +void AIScriptMutant1::FledCombat() { + Actor_Set_Goal_Number(kActorMutant1, 403); +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ai_script.cpp b/engines/bladerunner/script/ai_script.cpp index 47c3f40504..4923b0548e 100644 --- a/engines/bladerunner/script/ai_script.cpp +++ b/engines/bladerunner/script/ai_script.cpp @@ -100,6 +100,7 @@ AIScripts::AIScripts(BladeRunnerEngine *vm, int actorCount) { _AIScripts[kActorGenwalkerA] = new AIScriptGenericWalkerA(_vm); // 67 _AIScripts[kActorGenwalkerB] = new AIScriptGenericWalkerB(_vm); // 68 _AIScripts[kActorGenwalkerC] = new AIScriptGenericWalkerC(_vm); // 69 + _AIScripts[kActorMutant1] = new AIScriptMutant1(_vm); // 70 } AIScripts::~AIScripts() { diff --git a/engines/bladerunner/script/ai_script.h b/engines/bladerunner/script/ai_script.h index 169d3a00d8..d8225bc39e 100644 --- a/engines/bladerunner/script/ai_script.h +++ b/engines/bladerunner/script/ai_script.h @@ -455,6 +455,10 @@ DECLARE_SCRIPT(GenericWalkerC) bool preparePath(); END_SCRIPT +DECLARE_SCRIPT(Mutant1) + bool _flag; +END_SCRIPT + #undef DECLARE_SCRIPT #undef END_SCRIPT |