1 /* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 *
21 */
22
23 #include "bladerunner/script/ai_script.h"
24
25 namespace BladeRunner {
26
AIScriptSergeantWalls(BladeRunnerEngine * vm)27 AIScriptSergeantWalls::AIScriptSergeantWalls(BladeRunnerEngine *vm) : AIScriptBase(vm) {
28 }
29
Initialize()30 void AIScriptSergeantWalls::Initialize() {
31 _animationFrame = 0;
32 _animationState = 0;
33 _animationStateNext = 0;
34 _animationNext = 0;
35 }
36
Update()37 bool AIScriptSergeantWalls::Update() {
38 if (Game_Flag_Query(kFlagSergeantWallsBuzzInRequest)
39 && Game_Flag_Query(kFlagSergeantWallsBuzzInDone)
40 ) {
41 Game_Flag_Reset(kFlagSergeantWallsBuzzInRequest);
42 }
43 return false;
44 }
45
TimerExpired(int timer)46 void AIScriptSergeantWalls::TimerExpired(int timer) {
47 //return false;
48 }
49
CompletedMovementTrack()50 void AIScriptSergeantWalls::CompletedMovementTrack() {
51 //return false;
52 }
53
ReceivedClue(int clueId,int fromActorId)54 void AIScriptSergeantWalls::ReceivedClue(int clueId, int fromActorId) {
55 //return false;
56 }
57
ClickedByPlayer()58 void AIScriptSergeantWalls::ClickedByPlayer() {
59 //return false;
60 }
61
EnteredSet(int setId)62 void AIScriptSergeantWalls::EnteredSet(int setId) {
63 // return false;
64 }
65
OtherAgentEnteredThisSet(int otherActorId)66 void AIScriptSergeantWalls::OtherAgentEnteredThisSet(int otherActorId) {
67 // return false;
68 }
69
OtherAgentExitedThisSet(int otherActorId)70 void AIScriptSergeantWalls::OtherAgentExitedThisSet(int otherActorId) {
71 // return false;
72 }
73
OtherAgentEnteredCombatMode(int otherActorId,int combatMode)74 void AIScriptSergeantWalls::OtherAgentEnteredCombatMode(int otherActorId, int combatMode) {
75 // return false;
76 }
77
ShotAtAndMissed()78 void AIScriptSergeantWalls::ShotAtAndMissed() {
79 // return false;
80 }
81
ShotAtAndHit()82 bool AIScriptSergeantWalls::ShotAtAndHit() {
83 return false;
84 }
85
Retired(int byActorId)86 void AIScriptSergeantWalls::Retired(int byActorId) {
87 // return false;
88 }
89
GetFriendlinessModifierIfGetsClue(int otherActorId,int clueId)90 int AIScriptSergeantWalls::GetFriendlinessModifierIfGetsClue(int otherActorId, int clueId) {
91 return 0;
92 }
93
GoalChanged(int currentGoalNumber,int newGoalNumber)94 bool AIScriptSergeantWalls::GoalChanged(int currentGoalNumber, int newGoalNumber) {
95 return false;
96 }
97
UpdateAnimation(int * animation,int * frame)98 bool AIScriptSergeantWalls::UpdateAnimation(int *animation, int *frame) {
99 switch (_animationState) {
100 case 0:
101 ++_animationFrame;
102 if ( Game_Flag_Query(kFlagSergeantWallsBuzzInRequest)
103 && !Game_Flag_Query(kFlagSergeantWallsBuzzInDone)
104 ) {
105 // TODO maybe use kModelAnimationSergeantWallsHitsBuzzerTalk here?
106 *animation = kModelAnimationSergeantWallsGestureGive;
107 if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(kModelAnimationSergeantWallsGestureGive)) {
108 _animationFrame = 0;
109 Game_Flag_Set(kFlagSergeantWallsBuzzInDone);
110 }
111 } else {
112 *animation = kModelAnimationSergeantWallsIdle;
113 if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(kModelAnimationSergeantWallsIdle)) {
114 _animationFrame = 0;
115 }
116 }
117 break;
118
119 case 1:
120 *animation = kModelAnimationSergeantWallsCalmTalk;
121 ++_animationFrame;
122 if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(kModelAnimationSergeantWallsCalmTalk)) {
123 _animationFrame = 0;
124 }
125 break;
126
127 case 3:
128 *animation = kModelAnimationSergeantWallsMoreHeadMoveTalk;
129 ++_animationFrame;
130 if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(kModelAnimationSergeantWallsMoreHeadMoveTalk)) {
131 _animationState = 1;
132 _animationFrame = 0;
133 *animation = kModelAnimationSergeantWallsCalmTalk;
134 }
135 break;
136
137 case 4:
138 *animation = kModelAnimationSergeantWallsExplainTalk;
139 ++_animationFrame;
140 if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(kModelAnimationSergeantWallsExplainTalk)) {
141 _animationState = 1;
142 _animationFrame = 0;
143 *animation = kModelAnimationSergeantWallsCalmTalk;
144 }
145 break;
146
147 case 5:
148 *animation = kModelAnimationSergeantWallsLaughTalk;
149 ++_animationFrame;
150 if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(kModelAnimationSergeantWallsLaughTalk)) {
151 _animationState = 1;
152 _animationFrame = 0;
153 *animation = kModelAnimationSergeantWallsCalmTalk;
154 }
155 break;
156
157 case 6:
158 *animation = kModelAnimationSergeantWallsHarderLaughTalk;
159 ++_animationFrame;
160 if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(kModelAnimationSergeantWallsHarderLaughTalk)) {
161 _animationState = 1;
162 _animationFrame = 0;
163 *animation = kModelAnimationSergeantWallsCalmTalk;
164 }
165 break;
166
167 case 7:
168 *animation = kModelAnimationSergeantWallsDefendTalk;
169 ++_animationFrame;
170 if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(kModelAnimationSergeantWallsDefendTalk)) {
171 _animationState = 1;
172 _animationFrame = 0;
173 *animation = kModelAnimationSergeantWallsCalmTalk;
174 }
175 break;
176
177 case 8:
178 *animation = kModelAnimationSergeantWallsHitsBuzzerTalk;
179 ++_animationFrame;
180 if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(kModelAnimationSergeantWallsHitsBuzzerTalk)) {
181 _animationState = 1;
182 _animationFrame = 0;
183 *animation = kModelAnimationSergeantWallsCalmTalk;
184 }
185 break;
186
187 case 9:
188 *animation = kModelAnimationSergeantWallsGestureGive;
189 ++_animationFrame;
190 if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(kModelAnimationSergeantWallsGestureGive)) {
191 _animationState = 9;
192 _animationFrame = 0;
193 *animation = kModelAnimationSergeantWallsGestureGive;
194 }
195 break;
196
197 default:
198 // Dummy placeholder, kModelAnimationZubenWalking (399) is a Zuben animation
199 *animation = kModelAnimationZubenWalking;
200 break;
201 }
202 *frame = _animationFrame;
203 return true;
204 }
205
ChangeAnimationMode(int mode)206 bool AIScriptSergeantWalls::ChangeAnimationMode(int mode) {
207 switch (mode) {
208 case kAnimationModeIdle:
209 _animationState = 0;
210 _animationFrame = 0;
211 break;
212
213 case kAnimationModeTalk:
214 _animationState = 1;
215 _animationFrame = 0;
216 break;
217
218 case 12:
219 _animationState = 3;
220 _animationFrame = 0;
221 break;
222
223 case 13:
224 _animationState = 4;
225 _animationFrame = 0;
226 break;
227
228 case 14:
229 _animationState = 5;
230 _animationFrame = 0;
231 break;
232
233 case 15:
234 _animationState = 6;
235 _animationFrame = 0;
236 break;
237
238 case 16:
239 _animationState = 7;
240 _animationFrame = 0;
241 break;
242
243 case 17:
244 _animationState = 8;
245 _animationFrame = 0;
246 break;
247
248 case 23:
249 _animationState = 9;
250 _animationFrame = 0;
251 break;
252 }
253 return true;
254 }
255
QueryAnimationState(int * animationState,int * animationFrame,int * animationStateNext,int * animationNext)256 void AIScriptSergeantWalls::QueryAnimationState(int *animationState, int *animationFrame, int *animationStateNext, int *animationNext) {
257 *animationState = _animationState;
258 *animationFrame = _animationFrame;
259 *animationStateNext = _animationStateNext;
260 *animationNext = _animationNext;
261 }
262
SetAnimationState(int animationState,int animationFrame,int animationStateNext,int animationNext)263 void AIScriptSergeantWalls::SetAnimationState(int animationState, int animationFrame, int animationStateNext, int animationNext) {
264 _animationState = animationState;
265 _animationFrame = animationFrame;
266 _animationStateNext = animationStateNext;
267 _animationNext = animationNext;
268 }
269
ReachedMovementTrackWaypoint(int waypointId)270 bool AIScriptSergeantWalls::ReachedMovementTrackWaypoint(int waypointId) {
271 return true;
272 }
273
FledCombat()274 void AIScriptSergeantWalls::FledCombat() {
275 // return false;
276 }
277
278 } // End of namespace BladeRunner
279