diff options
| author | Peter Kohaut | 2018-03-07 19:12:03 +0100 |
|---|---|---|
| committer | Peter Kohaut | 2018-03-07 19:21:04 +0100 |
| commit | c85201caf5524f3c0106c52fba4bd7a2ebfd1dc1 (patch) | |
| tree | 1814c245b9811c69bbf045a2e375f3910902b23b /engines/bladerunner/script/ai | |
| parent | 1c576ac30c507b83ffc91d2dd1d1cb7bc7b8949d (diff) | |
| download | scummvm-rg350-c85201caf5524f3c0106c52fba4bd7a2ebfd1dc1.tar.gz scummvm-rg350-c85201caf5524f3c0106c52fba4bd7a2ebfd1dc1.tar.bz2 scummvm-rg350-c85201caf5524f3c0106c52fba4bd7a2ebfd1dc1.zip | |
BLADERUNNER: Added Howie Lee actor
added some constants
added loop debugger command
Diffstat (limited to 'engines/bladerunner/script/ai')
| -rw-r--r-- | engines/bladerunner/script/ai/_template.cpp | 14 | ||||
| -rw-r--r-- | engines/bladerunner/script/ai/howie_lee.cpp | 386 | ||||
| -rw-r--r-- | engines/bladerunner/script/ai/zuben.cpp | 4 |
3 files changed, 401 insertions, 3 deletions
diff --git a/engines/bladerunner/script/ai/_template.cpp b/engines/bladerunner/script/ai/_template.cpp index cff8e62050..ceebd22594 100644 --- a/engines/bladerunner/script/ai/_template.cpp +++ b/engines/bladerunner/script/ai/_template.cpp @@ -39,30 +39,39 @@ bool AIScriptTemplate::Update() { } void AIScriptTemplate::TimerExpired(int timer) { + //return false; } void AIScriptTemplate::CompletedMovementTrack() { + //return false; } void AIScriptTemplate::ReceivedClue(int clueId, int fromActorId) { + //return false; } void AIScriptTemplate::ClickedByPlayer() { + //return false; } void AIScriptTemplate::EnteredScene(int sceneId) { + // return false; } void AIScriptTemplate::OtherAgentEnteredThisScene(int otherActorId) { + // return false; } void AIScriptTemplate::OtherAgentExitedThisScene(int otherActorId) { + // return false; } void AIScriptTemplate::OtherAgentEnteredCombatMode(int otherActorId, int combatMode) { + // return false; } void AIScriptTemplate::ShotAtAndMissed() { + // return false; } bool AIScriptTemplate::ShotAtAndHit() { @@ -70,6 +79,7 @@ bool AIScriptTemplate::ShotAtAndHit() { } void AIScriptTemplate::Retired(int byActorId) { + // return false; } int AIScriptTemplate::GetFriendlinessModifierIfGetsClue(int otherActorId, int clueId) { @@ -108,6 +118,8 @@ bool AIScriptTemplate::ReachedMovementTrackWaypoint(int waypointId) { return true; } -void AIScriptTemplate::FledCombat() {} +void AIScriptTemplate::FledCombat() { + // return false; +} } // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ai/howie_lee.cpp b/engines/bladerunner/script/ai/howie_lee.cpp new file mode 100644 index 0000000000..fac33acc93 --- /dev/null +++ b/engines/bladerunner/script/ai/howie_lee.cpp @@ -0,0 +1,386 @@ +/* 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 { + +AIScriptHowieLee::AIScriptHowieLee(BladeRunnerEngine *vm) : AIScriptBase(vm) { + var_45DFB8 = 0; +} + +void AIScriptHowieLee::Initialize() { + _animationFrame = 0; + _animationState = 0; + _animationStateNext = 0; + _animationNext = 0; + var_45DFB8 = false; + + Actor_Put_In_Set(kActorHowieLee, kSetCT01_CT12); + Actor_Set_At_Waypoint(kActorHowieLee, 67, 605); + Actor_Set_Goal_Number(kActorHowieLee, 0); +} + +bool AIScriptHowieLee::Update() { + if (Actor_Query_Goal_Number(kActorHowieLee) < 100 && Global_Variable_Query(kVariableChapter) == 2) { + Actor_Set_Goal_Number(kActorHowieLee, 100); + } + if (Global_Variable_Query(kVariableChapter) > 1) { + return true; + } + if (Actor_Query_Goal_Number(kActorHowieLee) == 0) { + Actor_Set_Goal_Number(kActorHowieLee, 1); + } + if (Game_Flag_Query(176) && !Actor_Query_In_Set(kActorHowieLee, kSetCT01_CT12)) { + AI_Movement_Track_Flush(kActorHowieLee); + AI_Movement_Track_Append(kActorHowieLee, 67, 0); + Actor_Set_Goal_Number(kActorHowieLee, 0); + } + if (Actor_Query_Goal_Number(kActorHowieLee) == 1 && Game_Flag_Query(kFlagBoughtHowieLeeFood) && !Game_Flag_Query(176)) { + Actor_Set_Goal_Number(kActorHowieLee, 4); + return true; + } + return false; +} + +void AIScriptHowieLee::TimerExpired(int timer) { + //return false; +} + +void AIScriptHowieLee::CompletedMovementTrack() { + if (Actor_Query_Goal_Number(kActorHowieLee) == 1) { + Actor_Set_Goal_Number(kActorHowieLee, 2); + // return true; + } else if (Actor_Query_Goal_Number(kActorHowieLee) == 2) { + Actor_Set_Goal_Number(kActorHowieLee, 3); + // return true; + } else if (Actor_Query_Goal_Number(kActorHowieLee) == 3) { + Actor_Set_Goal_Number(kActorHowieLee, 0); + // return true; + } else if (Actor_Query_Goal_Number(kActorHowieLee) == 3) { + // Bug/intentional in original game + Actor_Set_Goal_Number(kActorHowieLee, 4); + // return true; + } else if (Actor_Query_Goal_Number(kActorHowieLee) == 4) { + Actor_Set_Goal_Number(kActorHowieLee, 5); + // return true; + } else if (Actor_Query_Goal_Number(kActorHowieLee) == 5) { + Actor_Set_Goal_Number(kActorHowieLee, 0); + // return true; + } + // return false; +} + +void AIScriptHowieLee::ReceivedClue(int clueId, int fromActorId) { + //return false; +} + +void AIScriptHowieLee::ClickedByPlayer() { + //return false; +} + +void AIScriptHowieLee::EnteredScene(int sceneId) { + if (Actor_Query_Goal_Number(kActorHowieLee) == 4 && Actor_Query_In_Set(kActorHowieLee, kSetCT03_CT04)) { + if (Game_Flag_Query(169) && !Game_Flag_Query(170) && !Game_Flag_Query(171)) { + Game_Flag_Set(171); + // return false; + } + if (!Game_Flag_Query(169) && Game_Flag_Query(170) && !Game_Flag_Query(171) && Random_Query(1, 10) == 1) { + Game_Flag_Set(171); + // return true; + } + // return false; + } +} + +void AIScriptHowieLee::OtherAgentEnteredThisScene(int otherActorId) { + // return false; +} + +void AIScriptHowieLee::OtherAgentExitedThisScene(int otherActorId) { + // return false; +} + +void AIScriptHowieLee::OtherAgentEnteredCombatMode(int otherActorId, int combatMode) { + // return false; +} + +void AIScriptHowieLee::ShotAtAndMissed() { + // return false; +} + +bool AIScriptHowieLee::ShotAtAndHit() { + return false; +} + +void AIScriptHowieLee::Retired(int byActorId) { + // return false; +} + +int AIScriptHowieLee::GetFriendlinessModifierIfGetsClue(int otherActorId, int clueId) { + return 0; +} + +bool AIScriptHowieLee::GoalChanged(int currentGoalNumber, int newGoalNumber) { + if (newGoalNumber == 1) { + AI_Movement_Track_Flush(kActorHowieLee); + if (Random_Query(1, 2) == 1) { + AI_Movement_Track_Append_With_Facing(kActorHowieLee, 67, Random_Query(3, 10), 720); + } else { + AI_Movement_Track_Append_With_Facing(kActorHowieLee, 69, Random_Query(3, 10), 640); + } + AI_Movement_Track_Repeat(kActorHowieLee); + return true; + } else if (newGoalNumber == 2) { + AI_Movement_Track_Flush(kActorHowieLee); + if (Random_Query(1, 2) == 1) { + AI_Movement_Track_Append_With_Facing(kActorHowieLee, 68, Random_Query(3, 10), 641); + } else { + AI_Movement_Track_Append_With_Facing(kActorHowieLee, 67, Random_Query(3, 10), 720); + } + AI_Movement_Track_Repeat(kActorHowieLee); + return true; + } else if (newGoalNumber == 3) { + AI_Movement_Track_Flush(kActorHowieLee); + if (Random_Query(1, 2) == 1) { + AI_Movement_Track_Append_With_Facing(kActorHowieLee, 69, Random_Query(3, 10), 640); + } else { + AI_Movement_Track_Append_With_Facing(kActorHowieLee, 68, Random_Query(3, 10), 641); + } + AI_Movement_Track_Repeat(kActorHowieLee); + return true; + } else if (newGoalNumber == 4) { + AI_Movement_Track_Flush(kActorHowieLee); + AI_Movement_Track_Append(kActorHowieLee, 66, 30); + AI_Movement_Track_Repeat(kActorHowieLee); + return true; + } else if (newGoalNumber == 5) { + AI_Movement_Track_Flush(kActorHowieLee); + AI_Movement_Track_Append(kActorHowieLee, 40, 60); + AI_Movement_Track_Repeat(kActorHowieLee); + return true; + } else if (newGoalNumber == 6) { + AI_Movement_Track_Flush(kActorHowieLee); + AI_Movement_Track_Append(kActorHowieLee, 67, 90); + AI_Movement_Track_Repeat(kActorHowieLee); + return true; + } else if (newGoalNumber == 50) { + AI_Movement_Track_Flush(kActorHowieLee); + return false; + } else if (newGoalNumber == 100) { + AI_Movement_Track_Flush(kActorHowieLee); + Actor_Put_In_Set(kActorHowieLee, kSetFreeSlotC); + Actor_Set_At_Waypoint(kActorHowieLee, 35, 0); + return false; + } + return false; +} + +bool AIScriptHowieLee::UpdateAnimation(int *animation, int *frame) { + switch (_animationState) { + case 0: + _animationFrame++; + if (var_45DFB8) { + *animation = 673; + if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(673)) { + _animationFrame = 0; + if (Random_Query(0, 2) > 0) { + var_45DFB8 ^= 1; + } + } + } else { + *animation = 671; + if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(671)) { + _animationFrame = 0; + if (Random_Query(0, 1) > 0) { + var_45DFB8 ^= 1; + } + } + } + break; + case 1: + *animation = 674; + _animationFrame++; + if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(674)) { + _animationFrame = 0; + if (_animationState < 3 || _animationState > 8) { + _animationState = 0; + _animationFrame = 0; + var_45DFB8 = Random_Query(0, 1); + } else { + Game_Flag_Set(239); + } + *animation = 673; + } + break; + case 2: + *animation = 672; + _animationFrame++; + if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(672)) { + _animationFrame = 0; + } + break; + case 3: + if (Game_Flag_Query(239)) { + Game_Flag_Reset(239); + _animationState = 0; + _animationFrame = 0; + var_45DFB8 = Random_Query(0, 1); + *animation = 671; + } else { + _animationFrame++; + if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(676)) { + _animationFrame = 0; + } + *animation = 676; + } + break; + case 4: + *animation = 677; + _animationFrame++; + if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(677)) { + _animationState = 3; + _animationFrame = 0; + *animation = 676; + } + break; + case 5: + *animation = 678; + _animationFrame++; + if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(678)) { + _animationState = 3; + _animationFrame = 0; + *animation = 676; + } + break; + case 6: + *animation = 679; + _animationFrame++; + if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(679)) { + _animationState = 3; + _animationFrame = 0; + *animation = 676; + } + break; + case 7: + *animation = 680; + _animationFrame++; + if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(680)) { + _animationState = 3; + _animationFrame = 0; + *animation = 676; + } + break; + case 8: + *animation = 681; + _animationFrame++; + if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(681)) { + _animationState = 3; + _animationFrame = 0; + *animation = 676; + } + break; + default: + *animation = 399; + break; + } + *frame = _animationFrame; + return true; +} + +bool AIScriptHowieLee::ChangeAnimationMode(int mode) { + switch (mode) { + case kAnimationModeIdle: + if (_animationState < 3 || _animationState > 8) { + _animationState = 0; + _animationFrame = 0; + var_45DFB8 = Random_Query(0, 1); + } else { + Game_Flag_Set(239); + } + break; + case kAnimationModeWalk: + if (_animationState != 2) { + _animationState = 2; + _animationFrame = 0; + } + break; + case kAnimationModeTalk: + _animationState = 3; + _animationFrame = 0; + break; + case 12: + _animationState = 4; + _animationFrame = 0; + break; + case 13: + _animationState = 5; + _animationFrame = 0; + break; + case 14: + _animationState = 6; + _animationFrame = 0; + break; + case 15: + _animationState = 7; + _animationFrame = 0; + break; + case 16: + _animationState = 8; + _animationFrame = 0; + break; + case 43: + _animationState = 1; + _animationFrame = 0; + break; + } + return true; +} + +void AIScriptHowieLee::QueryAnimationState(int *animationState, int *animationFrame, int *animationStateNext, int *animationNext) { + *animationState = _animationState; + *animationFrame = _animationFrame; + *animationStateNext = _animationStateNext; + *animationNext = _animationNext; +} + +void AIScriptHowieLee::SetAnimationState(int animationState, int animationFrame, int animationStateNext, int animationNext) { + _animationState = animationState; + _animationFrame = animationFrame; + _animationStateNext = animationStateNext; + _animationNext = animationNext; +} + +bool AIScriptHowieLee::ReachedMovementTrackWaypoint(int waypointId) { + if (waypointId == 67 && Random_Query(1, 2) == 2) { + Actor_Face_Heading(kActorHowieLee, 850, 0); + _animationFrame = 0; + _animationState = 1; + } + return true; +} + +void AIScriptHowieLee::FledCombat() { + // return false; +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ai/zuben.cpp b/engines/bladerunner/script/ai/zuben.cpp index 7f1781110a..9fe6aa2f10 100644 --- a/engines/bladerunner/script/ai/zuben.cpp +++ b/engines/bladerunner/script/ai/zuben.cpp @@ -80,7 +80,7 @@ bool AIScriptZuben::Update() { } if (Actor_Query_Goal_Number(kActorZuben) == 12 && Player_Query_Current_Scene() == kSceneCT07) { AI_Countdown_Timer_Reset(kActorZuben, 0); - Game_Flag_Set(94); + Game_Flag_Set(kFlagWarehouseOpen); Actor_Set_Targetable(kActorZuben, true); if (Actor_Query_Goal_Number(kActorGordo) == 0) { Actor_Set_Goal_Number(kActorGordo, 1); @@ -382,7 +382,7 @@ bool AIScriptZuben::GoalChanged(int currentGoalNumber, int newGoalNumber) { Actor_Set_Goal_Number(kActorZuben, 9); return false; case 21: - Game_Flag_Set(94); + Game_Flag_Set(kFlagWarehouseOpen); Actor_Set_Targetable(kActorZuben, true); AI_Movement_Track_Flush(kActorZuben); AI_Movement_Track_Append_Run(kActorZuben, 125, 0); |
