1 //-------------------------------------------------------------------------
2 /*
3 Copyright (C) 1997, 2005 - 3D Realms Entertainment
4 
5 This file is part of Shadow Warrior version 1.2
6 
7 Shadow Warrior 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.
15 
16 See the GNU General Public License for more details.
17 
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
21 
22 Original Source: 1997 - Frank Maddin and Jim Norwood
23 Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
24 */
25 //-------------------------------------------------------------------------
26 #include "build.h"
27 
28 #include "keys.h"
29 #include "names2.h"
30 #include "panel.h"
31 #include "game.h"
32 #include "tags.h"
33 #include "ai.h"
34 #include "pal.h"
35 #include "player.h"
36 #include "net.h"
37 #include "weapon.h"
38 #include "track.h"
39 #include "actor.h"
40 #include "ninja.h"
41 #include "sprite.h"
42 
43 /*
44 
45  !AIC - Decision tables used in mostly ai.c DoActorActionDecide().
46 
47 */
48 
49 DECISION NinjaBattle[] =
50     {
51     {499, InitActorMoveCloser},
52     //{509, InitActorAmbientNoise},
53     //{710, InitActorRunAway},
54     {1024, InitActorAttack}
55     };
56 
57 DECISION NinjaOffense[] =
58     {
59     {499, InitActorMoveCloser},
60     //{509, InitActorAmbientNoise},
61     {1024, InitActorAttack}
62     };
63 
64 DECISION NinjaBroadcast[] =
65     {
66     //{1, InitActorAlertNoise},
67     {6, InitActorAmbientNoise},
68     {1024, InitActorDecide}
69     };
70 
71 DECISION NinjaSurprised[] =
72     {
73     {701, InitActorMoveCloser},
74     {1024, InitActorDecide}
75     };
76 
77 DECISION NinjaEvasive[] =
78     {
79     {400,   InitActorDuck}, // 100
80 //    {300,   InitActorEvade},
81 //    {800,   InitActorRunAway},
82     {1024,  NULL}
83     };
84 
85 DECISION NinjaLostTarget[] =
86     {
87     {900, InitActorFindPlayer},
88     {1024, InitActorWanderAround}
89     };
90 
91 DECISION NinjaCloseRange[] =
92     {
93     {700,   InitActorAttack             },
94     {1024,  InitActorReposition         }
95     };
96 
97 /*
98 
99  !AIC - Collection of decision tables
100 
101 */
102 
103 PERSONALITY NinjaPersonality =
104     {
105     NinjaBattle,
106     NinjaOffense,
107     NinjaBroadcast,
108     NinjaSurprised,
109     NinjaEvasive,
110     NinjaLostTarget,
111     NinjaCloseRange,
112     NinjaCloseRange
113     };
114 
115 // Sniper Ninjas
116 DECISION NinjaSniperRoam[] =
117     {
118     {1023, InitActorDuck},
119     {1024, InitActorAmbientNoise},
120     };
121 
122 DECISION NinjaSniperBattle[] =
123     {
124     {499, InitActorDuck},
125     {500, InitActorAmbientNoise},
126     {1024, InitActorAttack}
127     };
128 
129 PERSONALITY NinjaSniperPersonality =
130     {
131     NinjaSniperBattle,
132     NinjaSniperBattle,
133     NinjaSniperRoam,
134     NinjaSniperRoam,
135     NinjaSniperRoam,
136     NinjaSniperRoam,
137     NinjaSniperBattle,
138     NinjaSniperBattle
139     };
140 
141 
142 /*
143 
144  !AIC - Extra attributes - speeds for running, animation tic adjustments for speeeds, etc
145 
146 */
147 
148 ATTRIBUTE NinjaAttrib =
149     {
150     {110, 130, 150, 180},                 // Speeds
151     //{90, 110, 130, 160},                 // Speeds
152     //{60, 80, 100, 130},                 // Speeds
153     {4, 0, 0, -2},                     // Tic Adjusts
154      3,                                 // MaxWeapons;
155     {DIGI_NINJAAMBIENT, DIGI_NINJAALERT, DIGI_STAR,
156      DIGI_NINJAPAIN, DIGI_NINJASCREAM,0,0,0,0,0}
157     };
158 
159 ATTRIBUTE InvisibleNinjaAttrib =
160     {
161     {220, 240, 300, 360},                 // Speeds
162     {4, 0, 0, -2},                     // Tic Adjusts
163      3,                                 // MaxWeapons;
164     {DIGI_NINJAAMBIENT, DIGI_NINJAALERT, DIGI_STAR,
165      DIGI_NINJAPAIN, DIGI_NINJASCREAM,0,0,0,0,0}
166     };
167 
168 ATTRIBUTE DefaultAttrib =
169     {
170     {60, 80, 100, 130},                 // Speeds
171     {3, 0, -2, -3},                     // Tic Adjusts
172      3,                                  // MaxWeapons;
173     {0, 0, 0}
174     };
175 
176 //////////////////////
177 //
178 // NINJA RUN
179 //
180 //////////////////////
181 
182 ANIMATOR DoNinjaMove, DoNinjaCrawl, DoStayOnFloor, NullNinja, DoActorJump, DoActorFall, DoActorDebris, DoNinjaHariKari, DoActorSlide;
183 ANIMATOR InitActorDecide;
184 
185 #define NINJA_RATE 18
186 
187 STATE s_NinjaRun[5][4] =
188     {
189 
190     {
191     {NINJA_RUN_R0 + 0, NINJA_RATE | SF_TIC_ADJUST, DoNinjaMove, &s_NinjaRun[0][1]},
192     {NINJA_RUN_R0 + 1, NINJA_RATE | SF_TIC_ADJUST, DoNinjaMove, &s_NinjaRun[0][2]},
193     {NINJA_RUN_R0 + 2, NINJA_RATE | SF_TIC_ADJUST, DoNinjaMove, &s_NinjaRun[0][3]},
194     {NINJA_RUN_R0 + 3, NINJA_RATE | SF_TIC_ADJUST, DoNinjaMove, &s_NinjaRun[0][0]},
195     },
196     {
197     {NINJA_RUN_R1 + 0, NINJA_RATE | SF_TIC_ADJUST, DoNinjaMove, &s_NinjaRun[1][1]},
198     {NINJA_RUN_R1 + 1, NINJA_RATE | SF_TIC_ADJUST, DoNinjaMove, &s_NinjaRun[1][2]},
199     {NINJA_RUN_R1 + 2, NINJA_RATE | SF_TIC_ADJUST, DoNinjaMove, &s_NinjaRun[1][3]},
200     {NINJA_RUN_R1 + 3, NINJA_RATE | SF_TIC_ADJUST, DoNinjaMove, &s_NinjaRun[1][0]},
201     },
202     {
203     {NINJA_RUN_R2 + 0, NINJA_RATE | SF_TIC_ADJUST, DoNinjaMove, &s_NinjaRun[2][1]},
204     {NINJA_RUN_R2 + 1, NINJA_RATE | SF_TIC_ADJUST, DoNinjaMove, &s_NinjaRun[2][2]},
205     {NINJA_RUN_R2 + 2, NINJA_RATE | SF_TIC_ADJUST, DoNinjaMove, &s_NinjaRun[2][3]},
206     {NINJA_RUN_R2 + 3, NINJA_RATE | SF_TIC_ADJUST, DoNinjaMove, &s_NinjaRun[2][0]},
207     },
208     {
209     {NINJA_RUN_R3 + 0, NINJA_RATE | SF_TIC_ADJUST, DoNinjaMove, &s_NinjaRun[3][1]},
210     {NINJA_RUN_R3 + 1, NINJA_RATE | SF_TIC_ADJUST, DoNinjaMove, &s_NinjaRun[3][2]},
211     {NINJA_RUN_R3 + 2, NINJA_RATE | SF_TIC_ADJUST, DoNinjaMove, &s_NinjaRun[3][3]},
212     {NINJA_RUN_R3 + 3, NINJA_RATE | SF_TIC_ADJUST, DoNinjaMove, &s_NinjaRun[3][0]},
213     },
214     {
215     {NINJA_RUN_R4 + 0, NINJA_RATE | SF_TIC_ADJUST, DoNinjaMove, &s_NinjaRun[4][1]},
216     {NINJA_RUN_R4 + 1, NINJA_RATE | SF_TIC_ADJUST, DoNinjaMove, &s_NinjaRun[4][2]},
217     {NINJA_RUN_R4 + 2, NINJA_RATE | SF_TIC_ADJUST, DoNinjaMove, &s_NinjaRun[4][3]},
218     {NINJA_RUN_R4 + 3, NINJA_RATE | SF_TIC_ADJUST, DoNinjaMove, &s_NinjaRun[4][0]},
219     },
220 
221     };
222 
223 #if 0
224 STATE s_NinjaRun[5][6] =
225     {
226 
227     {
228     {NINJA_RUN_R0 + 0, NINJA_RATE | SF_TIC_ADJUST, DoNinjaMove, &s_NinjaRun[0][1]},
229     {NINJA_RUN_R0 + 1, NINJA_RATE | SF_TIC_ADJUST, DoNinjaMove, &s_NinjaRun[0][2]},
230     {NINJA_RUN_R0 + 2, NINJA_RATE | SF_TIC_ADJUST, DoNinjaMove, &s_NinjaRun[0][3]},
231     {NINJA_RUN_R0 + 3, NINJA_RATE | SF_TIC_ADJUST, DoNinjaMove, &s_NinjaRun[0][4]},
232     {NINJA_RUN_R0 + 4, NINJA_RATE | SF_TIC_ADJUST, DoNinjaMove, &s_NinjaRun[0][5]},
233     {NINJA_RUN_R0 + 5, NINJA_RATE | SF_TIC_ADJUST, DoNinjaMove, &s_NinjaRun[0][0]},
234     },
235     {
236     {NINJA_RUN_R1 + 0, NINJA_RATE | SF_TIC_ADJUST, DoNinjaMove, &s_NinjaRun[1][1]},
237     {NINJA_RUN_R1 + 1, NINJA_RATE | SF_TIC_ADJUST, DoNinjaMove, &s_NinjaRun[1][2]},
238     {NINJA_RUN_R1 + 2, NINJA_RATE | SF_TIC_ADJUST, DoNinjaMove, &s_NinjaRun[1][3]},
239     {NINJA_RUN_R1 + 3, NINJA_RATE | SF_TIC_ADJUST, DoNinjaMove, &s_NinjaRun[1][4]},
240     {NINJA_RUN_R1 + 4, NINJA_RATE | SF_TIC_ADJUST, DoNinjaMove, &s_NinjaRun[1][5]},
241     {NINJA_RUN_R1 + 5, NINJA_RATE | SF_TIC_ADJUST, DoNinjaMove, &s_NinjaRun[1][0]},
242     },
243     {
244     {NINJA_RUN_R2 + 0, NINJA_RATE | SF_TIC_ADJUST, DoNinjaMove, &s_NinjaRun[2][1]},
245     {NINJA_RUN_R2 + 1, NINJA_RATE | SF_TIC_ADJUST, DoNinjaMove, &s_NinjaRun[2][2]},
246     {NINJA_RUN_R2 + 2, NINJA_RATE | SF_TIC_ADJUST, DoNinjaMove, &s_NinjaRun[2][3]},
247     {NINJA_RUN_R2 + 3, NINJA_RATE | SF_TIC_ADJUST, DoNinjaMove, &s_NinjaRun[2][4]},
248     {NINJA_RUN_R2 + 4, NINJA_RATE | SF_TIC_ADJUST, DoNinjaMove, &s_NinjaRun[2][5]},
249     {NINJA_RUN_R2 + 5, NINJA_RATE | SF_TIC_ADJUST, DoNinjaMove, &s_NinjaRun[2][0]},
250     },
251     {
252     {NINJA_RUN_R3 + 0, NINJA_RATE | SF_TIC_ADJUST, DoNinjaMove, &s_NinjaRun[3][1]},
253     {NINJA_RUN_R3 + 1, NINJA_RATE | SF_TIC_ADJUST, DoNinjaMove, &s_NinjaRun[3][2]},
254     {NINJA_RUN_R3 + 2, NINJA_RATE | SF_TIC_ADJUST, DoNinjaMove, &s_NinjaRun[3][3]},
255     {NINJA_RUN_R3 + 3, NINJA_RATE | SF_TIC_ADJUST, DoNinjaMove, &s_NinjaRun[3][4]},
256     {NINJA_RUN_R3 + 4, NINJA_RATE | SF_TIC_ADJUST, DoNinjaMove, &s_NinjaRun[3][5]},
257     {NINJA_RUN_R3 + 5, NINJA_RATE | SF_TIC_ADJUST, DoNinjaMove, &s_NinjaRun[3][0]},
258     },
259     {
260     {NINJA_RUN_R4 + 0, NINJA_RATE | SF_TIC_ADJUST, DoNinjaMove, &s_NinjaRun[4][1]},
261     {NINJA_RUN_R4 + 1, NINJA_RATE | SF_TIC_ADJUST, DoNinjaMove, &s_NinjaRun[4][2]},
262     {NINJA_RUN_R4 + 2, NINJA_RATE | SF_TIC_ADJUST, DoNinjaMove, &s_NinjaRun[4][3]},
263     {NINJA_RUN_R4 + 3, NINJA_RATE | SF_TIC_ADJUST, DoNinjaMove, &s_NinjaRun[4][4]},
264     {NINJA_RUN_R4 + 4, NINJA_RATE | SF_TIC_ADJUST, DoNinjaMove, &s_NinjaRun[4][5]},
265     {NINJA_RUN_R4 + 5, NINJA_RATE | SF_TIC_ADJUST, DoNinjaMove, &s_NinjaRun[4][0]},
266     },
267 
268     };
269 #endif
270 
271 STATEp sg_NinjaRun[] =
272     {
273     s_NinjaRun[0],
274     s_NinjaRun[1],
275     s_NinjaRun[2],
276     s_NinjaRun[3],
277     s_NinjaRun[4]
278     };
279 
280 //////////////////////
281 //
282 // NINJA STAND
283 //
284 //////////////////////
285 
286 #define NINJA_STAND_RATE 10
287 
288 STATE s_NinjaStand[5][1] =
289     {
290     {
291     {NINJA_STAND_R0 + 0, NINJA_STAND_RATE, DoNinjaMove, &s_NinjaStand[0][0]},
292     },
293     {
294     {NINJA_STAND_R1 + 0, NINJA_STAND_RATE, DoNinjaMove, &s_NinjaStand[1][0]},
295     },
296     {
297     {NINJA_STAND_R2 + 0, NINJA_STAND_RATE, DoNinjaMove, &s_NinjaStand[2][0]},
298     },
299     {
300     {NINJA_STAND_R3 + 0, NINJA_STAND_RATE, DoNinjaMove, &s_NinjaStand[3][0]},
301     },
302     {
303     {NINJA_STAND_R4 + 0, NINJA_STAND_RATE, DoNinjaMove, &s_NinjaStand[4][0]},
304     },
305     };
306 
307 
308 STATEp sg_NinjaStand[] =
309     {
310     s_NinjaStand[0],
311     s_NinjaStand[1],
312     s_NinjaStand[2],
313     s_NinjaStand[3],
314     s_NinjaStand[4]
315     };
316 
317 //////////////////////
318 //
319 // NINJA RISE
320 //
321 //////////////////////
322 
323 #define NINJA_RISE_RATE 10
324 
325 STATE s_NinjaRise[5][3] =
326     {
327     {
328     {NINJA_KNEEL_R0 + 0, NINJA_RISE_RATE, NullNinja, &s_NinjaRise[0][1]},
329     {NINJA_STAND_R0 + 0, NINJA_STAND_RATE, NullNinja, &s_NinjaRise[0][2]},
330     {0, 0, NULL, (STATEp)sg_NinjaRun},
331     },
332     {
333     {NINJA_KNEEL_R1 + 0, NINJA_RISE_RATE, NullNinja, &s_NinjaRise[1][1]},
334     {NINJA_STAND_R1 + 0, NINJA_STAND_RATE, NullNinja, &s_NinjaRise[1][2]},
335     {0, 0, NULL, (STATEp)sg_NinjaRun},
336     },
337     {
338     {NINJA_KNEEL_R2 + 0, NINJA_RISE_RATE, NullNinja, &s_NinjaRise[2][1]},
339     {NINJA_STAND_R2 + 0, NINJA_STAND_RATE, NullNinja, &s_NinjaRise[2][2]},
340     {0, 0, NULL, (STATEp)sg_NinjaRun},
341     },
342     {
343     {NINJA_KNEEL_R3 + 0, NINJA_RISE_RATE, NullNinja, &s_NinjaRise[3][1]},
344     {NINJA_STAND_R3 + 0, NINJA_STAND_RATE, NullNinja, &s_NinjaRise[3][2]},
345     {0, 0, NULL, (STATEp)sg_NinjaRun},
346     },
347     {
348     {NINJA_KNEEL_R4 + 0, NINJA_RISE_RATE, NullNinja, &s_NinjaRise[4][1]},
349     {NINJA_STAND_R4 + 0, NINJA_STAND_RATE, NullNinja, &s_NinjaRise[4][2]},
350     {0, 0, NULL, (STATEp)sg_NinjaRun},
351     },
352     };
353 
354 
355 STATEp sg_NinjaRise[] =
356     {
357     s_NinjaRise[0],
358     s_NinjaRise[1],
359     s_NinjaRise[2],
360     s_NinjaRise[3],
361     s_NinjaRise[4]
362     };
363 
364 
365 //////////////////////
366 //
367 // NINJA CRAWL
368 //
369 //////////////////////
370 
371 
372 #define NINJA_CRAWL_RATE 14
373 STATE s_NinjaCrawl[5][4] =
374     {
375     {
376     {NINJA_CRAWL_R0 + 0, NINJA_CRAWL_RATE, DoNinjaMove, &s_NinjaCrawl[0][1]},
377     {NINJA_CRAWL_R0 + 1, NINJA_CRAWL_RATE, DoNinjaMove, &s_NinjaCrawl[0][2]},
378     {NINJA_CRAWL_R0 + 2, NINJA_CRAWL_RATE, DoNinjaMove, &s_NinjaCrawl[0][3]},
379     {NINJA_CRAWL_R0 + 1, NINJA_CRAWL_RATE, DoNinjaMove, &s_NinjaCrawl[0][0]},
380     },
381     {
382     {NINJA_CRAWL_R1 + 0, NINJA_CRAWL_RATE, DoNinjaMove, &s_NinjaCrawl[1][1]},
383     {NINJA_CRAWL_R1 + 1, NINJA_CRAWL_RATE, DoNinjaMove, &s_NinjaCrawl[1][2]},
384     {NINJA_CRAWL_R1 + 2, NINJA_CRAWL_RATE, DoNinjaMove, &s_NinjaCrawl[1][3]},
385     {NINJA_CRAWL_R1 + 1, NINJA_CRAWL_RATE, DoNinjaMove, &s_NinjaCrawl[1][0]},
386     },
387     {
388     {NINJA_CRAWL_R2 + 0, NINJA_CRAWL_RATE, DoNinjaMove, &s_NinjaCrawl[2][1]},
389     {NINJA_CRAWL_R2 + 1, NINJA_CRAWL_RATE, DoNinjaMove, &s_NinjaCrawl[2][2]},
390     {NINJA_CRAWL_R2 + 2, NINJA_CRAWL_RATE, DoNinjaMove, &s_NinjaCrawl[2][3]},
391     {NINJA_CRAWL_R2 + 1, NINJA_CRAWL_RATE, DoNinjaMove, &s_NinjaCrawl[2][0]},
392     },
393     {
394     {NINJA_CRAWL_R3 + 0, NINJA_CRAWL_RATE, DoNinjaMove, &s_NinjaCrawl[3][1]},
395     {NINJA_CRAWL_R3 + 1, NINJA_CRAWL_RATE, DoNinjaMove, &s_NinjaCrawl[3][2]},
396     {NINJA_CRAWL_R3 + 2, NINJA_CRAWL_RATE, DoNinjaMove, &s_NinjaCrawl[3][3]},
397     {NINJA_CRAWL_R3 + 1, NINJA_CRAWL_RATE, DoNinjaMove, &s_NinjaCrawl[3][0]},
398     },
399     {
400     {NINJA_CRAWL_R4 + 0, NINJA_CRAWL_RATE, DoNinjaMove, &s_NinjaCrawl[4][1]},
401     {NINJA_CRAWL_R4 + 1, NINJA_CRAWL_RATE, DoNinjaMove, &s_NinjaCrawl[4][2]},
402     {NINJA_CRAWL_R4 + 2, NINJA_CRAWL_RATE, DoNinjaMove, &s_NinjaCrawl[4][3]},
403     {NINJA_CRAWL_R4 + 1, NINJA_CRAWL_RATE, DoNinjaMove, &s_NinjaCrawl[4][0]},
404     },
405     };
406 
407 
408 STATEp sg_NinjaCrawl[] =
409     {
410     s_NinjaCrawl[0],
411     s_NinjaCrawl[1],
412     s_NinjaCrawl[2],
413     s_NinjaCrawl[3],
414     s_NinjaCrawl[4]
415     };
416 
417 //////////////////////
418 //
419 // NINJA KNEEL_CRAWL
420 //
421 //////////////////////
422 
423 #define NINJA_KNEEL_CRAWL_RATE 20
424 
425 STATE s_NinjaKneelCrawl[5][5] =
426     {
427     {
428     {NINJA_KNEEL_R0 + 0, NINJA_KNEEL_CRAWL_RATE, NullNinja, &s_NinjaKneelCrawl[0][1]},
429     {NINJA_CRAWL_R0 + 0, NINJA_CRAWL_RATE, DoNinjaMove, &s_NinjaKneelCrawl[0][2]},
430     {NINJA_CRAWL_R0 + 1, NINJA_CRAWL_RATE, DoNinjaMove, &s_NinjaKneelCrawl[0][3]},
431     {NINJA_CRAWL_R0 + 2, NINJA_CRAWL_RATE, DoNinjaMove, &s_NinjaKneelCrawl[0][4]},
432     {NINJA_CRAWL_R0 + 1, NINJA_CRAWL_RATE, DoNinjaMove, &s_NinjaKneelCrawl[0][1]},
433     },
434     {
435     {NINJA_KNEEL_R1 + 0, NINJA_KNEEL_CRAWL_RATE, NullNinja, &s_NinjaKneelCrawl[1][1]},
436     {NINJA_CRAWL_R1 + 0, NINJA_CRAWL_RATE, DoNinjaMove, &s_NinjaKneelCrawl[1][2]},
437     {NINJA_CRAWL_R1 + 1, NINJA_CRAWL_RATE, DoNinjaMove, &s_NinjaKneelCrawl[1][3]},
438     {NINJA_CRAWL_R1 + 2, NINJA_CRAWL_RATE, DoNinjaMove, &s_NinjaKneelCrawl[1][4]},
439     {NINJA_CRAWL_R1 + 1, NINJA_CRAWL_RATE, DoNinjaMove, &s_NinjaKneelCrawl[1][1]},
440     },
441     {
442     {NINJA_KNEEL_R2 + 0, NINJA_KNEEL_CRAWL_RATE, NullNinja, &s_NinjaKneelCrawl[2][1]},
443     {NINJA_CRAWL_R2 + 0, NINJA_CRAWL_RATE, DoNinjaMove, &s_NinjaKneelCrawl[2][2]},
444     {NINJA_CRAWL_R2 + 1, NINJA_CRAWL_RATE, DoNinjaMove, &s_NinjaKneelCrawl[2][3]},
445     {NINJA_CRAWL_R2 + 2, NINJA_CRAWL_RATE, DoNinjaMove, &s_NinjaKneelCrawl[2][4]},
446     {NINJA_CRAWL_R2 + 1, NINJA_CRAWL_RATE, DoNinjaMove, &s_NinjaKneelCrawl[2][1]},
447     },
448     {
449     {NINJA_KNEEL_R3 + 0, NINJA_KNEEL_CRAWL_RATE, NullNinja, &s_NinjaKneelCrawl[3][1]},
450     {NINJA_CRAWL_R3 + 0, NINJA_CRAWL_RATE, DoNinjaMove, &s_NinjaKneelCrawl[3][2]},
451     {NINJA_CRAWL_R3 + 1, NINJA_CRAWL_RATE, DoNinjaMove, &s_NinjaKneelCrawl[3][3]},
452     {NINJA_CRAWL_R3 + 2, NINJA_CRAWL_RATE, DoNinjaMove, &s_NinjaKneelCrawl[3][4]},
453     {NINJA_CRAWL_R3 + 1, NINJA_CRAWL_RATE, DoNinjaMove, &s_NinjaKneelCrawl[3][1]},
454     },
455     {
456     {NINJA_KNEEL_R4 + 0, NINJA_KNEEL_CRAWL_RATE, NullNinja, &s_NinjaKneelCrawl[4][1]},
457     {NINJA_CRAWL_R4 + 0, NINJA_CRAWL_RATE, DoNinjaMove, &s_NinjaKneelCrawl[4][2]},
458     {NINJA_CRAWL_R4 + 1, NINJA_CRAWL_RATE, DoNinjaMove, &s_NinjaKneelCrawl[4][3]},
459     {NINJA_CRAWL_R4 + 2, NINJA_CRAWL_RATE, DoNinjaMove, &s_NinjaKneelCrawl[4][4]},
460     {NINJA_CRAWL_R4 + 1, NINJA_CRAWL_RATE, DoNinjaMove, &s_NinjaKneelCrawl[4][1]},
461     },
462     };
463 
464 
465 STATEp sg_NinjaKneelCrawl[] =
466     {
467     s_NinjaKneelCrawl[0],
468     s_NinjaKneelCrawl[1],
469     s_NinjaKneelCrawl[2],
470     s_NinjaKneelCrawl[3],
471     s_NinjaKneelCrawl[4]
472     };
473 
474 
475 //////////////////////
476 //
477 // NINJA DUCK
478 //
479 //////////////////////
480 
481 #define NINJA_DUCK_RATE 10
482 
483 STATE s_NinjaDuck[5][2] =
484     {
485     {
486     {NINJA_KNEEL_R0 + 0, NINJA_DUCK_RATE, NullNinja, &s_NinjaDuck[0][1]},
487     {NINJA_CRAWL_R0 + 0, NINJA_CRAWL_RATE, DoNinjaMove, &s_NinjaDuck[0][1]},
488     },
489     {
490     {NINJA_KNEEL_R1 + 0, NINJA_DUCK_RATE, NullNinja, &s_NinjaDuck[1][1]},
491     {NINJA_CRAWL_R1 + 0, NINJA_CRAWL_RATE, DoNinjaMove, &s_NinjaDuck[1][1]},
492     },
493     {
494     {NINJA_KNEEL_R2 + 0, NINJA_DUCK_RATE, NullNinja, &s_NinjaDuck[2][1]},
495     {NINJA_CRAWL_R2 + 0, NINJA_CRAWL_RATE, DoNinjaMove, &s_NinjaDuck[2][1]},
496     },
497     {
498     {NINJA_KNEEL_R3 + 0, NINJA_DUCK_RATE, NullNinja, &s_NinjaDuck[3][1]},
499     {NINJA_CRAWL_R3 + 0, NINJA_CRAWL_RATE, DoNinjaMove, &s_NinjaDuck[3][1]},
500     },
501     {
502     {NINJA_KNEEL_R4 + 0, NINJA_DUCK_RATE, NullNinja, &s_NinjaDuck[4][1]},
503     {NINJA_CRAWL_R4 + 0, NINJA_CRAWL_RATE, DoNinjaMove, &s_NinjaDuck[4][1]},
504     },
505     };
506 
507 
508 STATEp sg_NinjaDuck[] =
509     {
510     s_NinjaDuck[0],
511     s_NinjaDuck[1],
512     s_NinjaDuck[2],
513     s_NinjaDuck[3],
514     s_NinjaDuck[4]
515     };
516 
517 
518 //////////////////////
519 //
520 // NINJA SIT
521 //
522 //////////////////////
523 
524 STATE s_NinjaSit[5][1] =
525     {
526     {
527     {NINJA_KNEEL_R0 + 0, NINJA_RISE_RATE, DoNinjaMove, &s_NinjaSit[0][0]},
528     },
529     {
530     {NINJA_KNEEL_R1 + 0, NINJA_RISE_RATE, DoNinjaMove, &s_NinjaSit[1][0]},
531     },
532     {
533     {NINJA_KNEEL_R2 + 0, NINJA_RISE_RATE, DoNinjaMove, &s_NinjaSit[2][0]},
534     },
535     {
536     {NINJA_KNEEL_R3 + 0, NINJA_RISE_RATE, DoNinjaMove, &s_NinjaSit[3][0]},
537     },
538     {
539     {NINJA_KNEEL_R4 + 0, NINJA_RISE_RATE, DoNinjaMove, &s_NinjaSit[4][0]},
540     },
541     };
542 
543 
544 STATEp sg_NinjaSit[] =
545     {
546     s_NinjaSit[0],
547     s_NinjaSit[1],
548     s_NinjaSit[2],
549     s_NinjaSit[3],
550     s_NinjaSit[4]
551     };
552 
553 //////////////////////
554 //
555 // NINJA CEILING
556 //
557 //////////////////////
558 
559 ANIMATOR DoNinjaCeiling;
560 STATE s_NinjaCeiling[5][1] =
561     {
562     {
563     {NINJA_KNEEL_R0 + 0, NINJA_RISE_RATE, DoNinjaCeiling, &s_NinjaCeiling[0][0]},
564     },
565     {
566     {NINJA_KNEEL_R1 + 0, NINJA_RISE_RATE, DoNinjaCeiling, &s_NinjaCeiling[1][0]},
567     },
568     {
569     {NINJA_KNEEL_R2 + 0, NINJA_RISE_RATE, DoNinjaCeiling, &s_NinjaCeiling[2][0]},
570     },
571     {
572     {NINJA_KNEEL_R3 + 0, NINJA_RISE_RATE, DoNinjaCeiling, &s_NinjaCeiling[3][0]},
573     },
574     {
575     {NINJA_KNEEL_R4 + 0, NINJA_RISE_RATE, DoNinjaCeiling, &s_NinjaCeiling[4][0]},
576     },
577     };
578 
579 
580 STATEp sg_NinjaCeiling[] =
581     {
582     s_NinjaCeiling[0],
583     s_NinjaCeiling[1],
584     s_NinjaCeiling[2],
585     s_NinjaCeiling[3],
586     s_NinjaCeiling[4]
587     };
588 
589 
590 //////////////////////
591 //
592 // NINJA JUMP
593 //
594 //////////////////////
595 
596 #define NINJA_JUMP_RATE 24
597 
598 STATE s_NinjaJump[5][2] =
599     {
600     {
601     {NINJA_JUMP_R0 + 0, NINJA_JUMP_RATE, DoNinjaMove, &s_NinjaJump[0][1]},
602     {NINJA_JUMP_R0 + 1, NINJA_JUMP_RATE, DoNinjaMove, &s_NinjaJump[0][1]},
603     },
604     {
605     {NINJA_JUMP_R1 + 0, NINJA_JUMP_RATE, DoNinjaMove, &s_NinjaJump[1][1]},
606     {NINJA_JUMP_R1 + 1, NINJA_JUMP_RATE, DoNinjaMove, &s_NinjaJump[1][1]},
607     },
608     {
609     {NINJA_JUMP_R2 + 0, NINJA_JUMP_RATE, DoNinjaMove, &s_NinjaJump[2][1]},
610     {NINJA_JUMP_R2 + 1, NINJA_JUMP_RATE, DoNinjaMove, &s_NinjaJump[2][1]},
611     },
612     {
613     {NINJA_JUMP_R3 + 0, NINJA_JUMP_RATE, DoNinjaMove, &s_NinjaJump[3][1]},
614     {NINJA_JUMP_R3 + 1, NINJA_JUMP_RATE, DoNinjaMove, &s_NinjaJump[3][1]},
615     },
616     {
617     {NINJA_JUMP_R4 + 0, NINJA_JUMP_RATE, DoNinjaMove, &s_NinjaJump[4][1]},
618     {NINJA_JUMP_R4 + 1, NINJA_JUMP_RATE, DoNinjaMove, &s_NinjaJump[4][1]},
619     },
620     };
621 
622 
623 STATEp sg_NinjaJump[] =
624     {
625     s_NinjaJump[0],
626     s_NinjaJump[1],
627     s_NinjaJump[2],
628     s_NinjaJump[3],
629     s_NinjaJump[4]
630     };
631 
632 
633 //////////////////////
634 //
635 // NINJA FALL
636 //
637 //////////////////////
638 
639 #define NINJA_FALL_RATE 16
640 
641 STATE s_NinjaFall[5][2] =
642     {
643     {
644     {NINJA_JUMP_R0 + 1, NINJA_FALL_RATE, DoNinjaMove, &s_NinjaFall[0][1]},
645     {NINJA_JUMP_R0 + 2, NINJA_FALL_RATE, DoNinjaMove, &s_NinjaFall[0][1]},
646     },
647     {
648     {NINJA_JUMP_R1 + 1, NINJA_FALL_RATE, DoNinjaMove, &s_NinjaFall[1][1]},
649     {NINJA_JUMP_R1 + 2, NINJA_FALL_RATE, DoNinjaMove, &s_NinjaFall[1][1]},
650     },
651     {
652     {NINJA_JUMP_R2 + 1, NINJA_FALL_RATE, DoNinjaMove, &s_NinjaFall[2][1]},
653     {NINJA_JUMP_R2 + 2, NINJA_FALL_RATE, DoNinjaMove, &s_NinjaFall[2][1]},
654     },
655     {
656     {NINJA_JUMP_R3 + 1, NINJA_FALL_RATE, DoNinjaMove, &s_NinjaFall[3][1]},
657     {NINJA_JUMP_R3 + 2, NINJA_FALL_RATE, DoNinjaMove, &s_NinjaFall[3][1]},
658     },
659     {
660     {NINJA_JUMP_R4 + 1, NINJA_FALL_RATE, DoNinjaMove, &s_NinjaFall[4][1]},
661     {NINJA_JUMP_R4 + 2, NINJA_FALL_RATE, DoNinjaMove, &s_NinjaFall[4][1]},
662     },
663     };
664 
665 
666 STATEp sg_NinjaFall[] =
667     {
668     s_NinjaFall[0],
669     s_NinjaFall[1],
670     s_NinjaFall[2],
671     s_NinjaFall[3],
672     s_NinjaFall[4]
673     };
674 
675 //////////////////////
676 //
677 // NINJA SWIM
678 //
679 //////////////////////
680 
681 
682 #define NINJA_SWIM_RATE 18
683 STATE s_NinjaSwim[5][3] =
684     {
685     {
686     {NINJA_SWIM_R0 + 1, NINJA_SWIM_RATE, DoNinjaMove, &s_NinjaSwim[0][1]},
687     {NINJA_SWIM_R0 + 2, NINJA_SWIM_RATE, DoNinjaMove, &s_NinjaSwim[0][2]},
688     {NINJA_SWIM_R0 + 3, NINJA_SWIM_RATE, DoNinjaMove, &s_NinjaSwim[0][0]},
689     },
690     {
691     {NINJA_SWIM_R1 + 1, NINJA_SWIM_RATE, DoNinjaMove, &s_NinjaSwim[1][1]},
692     {NINJA_SWIM_R1 + 2, NINJA_SWIM_RATE, DoNinjaMove, &s_NinjaSwim[1][2]},
693     {NINJA_SWIM_R1 + 3, NINJA_SWIM_RATE, DoNinjaMove, &s_NinjaSwim[1][0]},
694     },
695     {
696     {NINJA_SWIM_R2 + 1, NINJA_SWIM_RATE, DoNinjaMove, &s_NinjaSwim[2][1]},
697     {NINJA_SWIM_R2 + 2, NINJA_SWIM_RATE, DoNinjaMove, &s_NinjaSwim[2][2]},
698     {NINJA_SWIM_R2 + 3, NINJA_SWIM_RATE, DoNinjaMove, &s_NinjaSwim[2][0]},
699     },
700     {
701     {NINJA_SWIM_R3 + 1, NINJA_SWIM_RATE, DoNinjaMove, &s_NinjaSwim[3][1]},
702     {NINJA_SWIM_R3 + 2, NINJA_SWIM_RATE, DoNinjaMove, &s_NinjaSwim[3][2]},
703     {NINJA_SWIM_R3 + 3, NINJA_SWIM_RATE, DoNinjaMove, &s_NinjaSwim[3][0]},
704     },
705     {
706     {NINJA_SWIM_R4 + 1, NINJA_SWIM_RATE, DoNinjaMove, &s_NinjaSwim[4][1]},
707     {NINJA_SWIM_R4 + 2, NINJA_SWIM_RATE, DoNinjaMove, &s_NinjaSwim[4][2]},
708     {NINJA_SWIM_R4 + 3, NINJA_SWIM_RATE, DoNinjaMove, &s_NinjaSwim[4][0]},
709     },
710     };
711 
712 
713 STATEp sg_NinjaSwim[] =
714     {
715     s_NinjaSwim[0],
716     s_NinjaSwim[1],
717     s_NinjaSwim[2],
718     s_NinjaSwim[3],
719     s_NinjaSwim[4]
720     };
721 
722 //////////////////////
723 //
724 // NINJA DIVE
725 //
726 //////////////////////
727 
728 
729 #define NINJA_DIVE_RATE 23
730 
731 STATE s_NinjaDive[5][4] =
732     {
733     {
734     {NINJA_SWIM_R0 + 0, NINJA_DIVE_RATE, DoNinjaMove, &s_NinjaDive[0][1]},
735     {NINJA_SWIM_R0 + 1, NINJA_DIVE_RATE, DoNinjaMove, &s_NinjaDive[0][2]},
736     {NINJA_SWIM_R0 + 2, NINJA_DIVE_RATE, DoNinjaMove, &s_NinjaDive[0][3]},
737     {NINJA_SWIM_R0 + 3, NINJA_DIVE_RATE, DoNinjaMove, &s_NinjaDive[0][0]},
738     },
739     {
740     {NINJA_SWIM_R1 + 0, NINJA_DIVE_RATE, DoNinjaMove, &s_NinjaDive[1][1]},
741     {NINJA_SWIM_R1 + 1, NINJA_DIVE_RATE, DoNinjaMove, &s_NinjaDive[1][2]},
742     {NINJA_SWIM_R1 + 2, NINJA_DIVE_RATE, DoNinjaMove, &s_NinjaDive[1][3]},
743     {NINJA_SWIM_R1 + 3, NINJA_DIVE_RATE, DoNinjaMove, &s_NinjaDive[1][0]},
744     },
745     {
746     {NINJA_SWIM_R2 + 0, NINJA_DIVE_RATE, DoNinjaMove, &s_NinjaDive[2][1]},
747     {NINJA_SWIM_R2 + 1, NINJA_DIVE_RATE, DoNinjaMove, &s_NinjaDive[2][2]},
748     {NINJA_SWIM_R2 + 2, NINJA_DIVE_RATE, DoNinjaMove, &s_NinjaDive[2][3]},
749     {NINJA_SWIM_R2 + 3, NINJA_DIVE_RATE, DoNinjaMove, &s_NinjaDive[2][0]},
750     },
751     {
752     {NINJA_SWIM_R3 + 0, NINJA_DIVE_RATE, DoNinjaMove, &s_NinjaDive[3][1]},
753     {NINJA_SWIM_R3 + 1, NINJA_DIVE_RATE, DoNinjaMove, &s_NinjaDive[3][2]},
754     {NINJA_SWIM_R3 + 2, NINJA_DIVE_RATE, DoNinjaMove, &s_NinjaDive[3][3]},
755     {NINJA_SWIM_R3 + 3, NINJA_DIVE_RATE, DoNinjaMove, &s_NinjaDive[3][0]},
756     },
757     {
758     {NINJA_SWIM_R4 + 0, NINJA_DIVE_RATE, DoNinjaMove, &s_NinjaDive[4][1]},
759     {NINJA_SWIM_R4 + 1, NINJA_DIVE_RATE, DoNinjaMove, &s_NinjaDive[4][2]},
760     {NINJA_SWIM_R4 + 2, NINJA_DIVE_RATE, DoNinjaMove, &s_NinjaDive[4][3]},
761     {NINJA_SWIM_R4 + 3, NINJA_DIVE_RATE, DoNinjaMove, &s_NinjaDive[4][0]},
762     },
763     };
764 
765 STATEp sg_NinjaDive[] =
766     {
767     s_NinjaDive[0],
768     s_NinjaDive[1],
769     s_NinjaDive[2],
770     s_NinjaDive[3],
771     s_NinjaDive[4]
772     };
773 
774 //////////////////////
775 //
776 // NINJA CLIMB
777 //
778 //////////////////////
779 
780 
781 #define NINJA_CLIMB_RATE 20
782 STATE s_NinjaClimb[5][4] =
783     {
784     {
785     {NINJA_CLIMB_R0 + 0, NINJA_CLIMB_RATE, DoNinjaMove, &s_NinjaClimb[0][1]},
786     {NINJA_CLIMB_R0 + 1, NINJA_CLIMB_RATE, DoNinjaMove, &s_NinjaClimb[0][2]},
787     {NINJA_CLIMB_R0 + 2, NINJA_CLIMB_RATE, DoNinjaMove, &s_NinjaClimb[0][3]},
788     {NINJA_CLIMB_R0 + 3, NINJA_CLIMB_RATE, DoNinjaMove, &s_NinjaClimb[0][0]},
789     },
790     {
791     {NINJA_CLIMB_R1 + 0, NINJA_CLIMB_RATE, DoNinjaMove, &s_NinjaClimb[1][1]},
792     {NINJA_CLIMB_R1 + 1, NINJA_CLIMB_RATE, DoNinjaMove, &s_NinjaClimb[1][2]},
793     {NINJA_CLIMB_R1 + 2, NINJA_CLIMB_RATE, DoNinjaMove, &s_NinjaClimb[1][3]},
794     {NINJA_CLIMB_R1 + 3, NINJA_CLIMB_RATE, DoNinjaMove, &s_NinjaClimb[1][0]},
795     },
796     {
797     {NINJA_CLIMB_R4 + 0, NINJA_CLIMB_RATE, DoNinjaMove, &s_NinjaClimb[2][1]},
798     {NINJA_CLIMB_R4 + 1, NINJA_CLIMB_RATE, DoNinjaMove, &s_NinjaClimb[2][2]},
799     {NINJA_CLIMB_R4 + 2, NINJA_CLIMB_RATE, DoNinjaMove, &s_NinjaClimb[2][3]},
800     {NINJA_CLIMB_R4 + 3, NINJA_CLIMB_RATE, DoNinjaMove, &s_NinjaClimb[2][0]},
801     },
802     {
803     {NINJA_CLIMB_R3 + 0, NINJA_CLIMB_RATE, DoNinjaMove, &s_NinjaClimb[3][1]},
804     {NINJA_CLIMB_R3 + 1, NINJA_CLIMB_RATE, DoNinjaMove, &s_NinjaClimb[3][2]},
805     {NINJA_CLIMB_R3 + 2, NINJA_CLIMB_RATE, DoNinjaMove, &s_NinjaClimb[3][3]},
806     {NINJA_CLIMB_R3 + 3, NINJA_CLIMB_RATE, DoNinjaMove, &s_NinjaClimb[3][0]},
807     },
808     {
809     {NINJA_CLIMB_R2 + 0, NINJA_CLIMB_RATE, DoNinjaMove, &s_NinjaClimb[4][1]},
810     {NINJA_CLIMB_R2 + 1, NINJA_CLIMB_RATE, DoNinjaMove, &s_NinjaClimb[4][2]},
811     {NINJA_CLIMB_R2 + 2, NINJA_CLIMB_RATE, DoNinjaMove, &s_NinjaClimb[4][3]},
812     {NINJA_CLIMB_R2 + 3, NINJA_CLIMB_RATE, DoNinjaMove, &s_NinjaClimb[4][0]},
813     },
814     };
815 
816 STATEp sg_NinjaClimb[] =
817     {
818     s_NinjaClimb[0],
819     s_NinjaClimb[1],
820     s_NinjaClimb[2],
821     s_NinjaClimb[3],
822     s_NinjaClimb[4]
823     };
824 
825 
826 //////////////////////
827 //
828 // NINJA FLY
829 //
830 //////////////////////
831 
832 #define NINJA_FLY_RATE 12
833 
834 STATE s_NinjaFly[5][1] =
835     {
836     {
837     {NINJA_FLY_R0 + 0, NINJA_FLY_RATE, DoNinjaMove, &s_NinjaFly[0][0]},
838     },
839     {
840     {NINJA_FLY_R1 + 0, NINJA_FLY_RATE, DoNinjaMove, &s_NinjaFly[1][0]},
841     },
842     {
843     {NINJA_FLY_R2 + 0, NINJA_FLY_RATE, DoNinjaMove, &s_NinjaFly[2][0]},
844     },
845     {
846     {NINJA_FLY_R3 + 0, NINJA_FLY_RATE, DoNinjaMove, &s_NinjaFly[3][0]},
847     },
848     {
849     {NINJA_FLY_R4 + 0, NINJA_FLY_RATE, DoNinjaMove, &s_NinjaFly[4][0]},
850     },
851     };
852 
853 STATEp sg_NinjaFly[] =
854     {
855     s_NinjaFly[0],
856     s_NinjaFly[1],
857     s_NinjaFly[2],
858     s_NinjaFly[3],
859     s_NinjaFly[4]
860     };
861 
862 //////////////////////
863 //
864 // NINJA PAIN
865 //
866 //////////////////////
867 
868 #define NINJA_PAIN_RATE 15
869 ANIMATOR DoNinjaPain;
870 
871 STATE s_NinjaPain[5][2] =
872     {
873     {
874     {NINJA_PAIN_R0 + 0, NINJA_PAIN_RATE, DoNinjaPain, &s_NinjaPain[0][1]},
875     {NINJA_PAIN_R0 + 1, NINJA_PAIN_RATE, DoNinjaPain, &s_NinjaPain[0][1]},
876     },
877     {
878     {NINJA_STAND_R1 + 0, NINJA_PAIN_RATE, DoNinjaPain, &s_NinjaPain[1][1]},
879     {NINJA_STAND_R1 + 0, NINJA_PAIN_RATE, DoNinjaPain, &s_NinjaPain[1][1]},
880     },
881     {
882     {NINJA_STAND_R2 + 0, NINJA_PAIN_RATE, DoNinjaPain, &s_NinjaPain[2][1]},
883     {NINJA_STAND_R2 + 0, NINJA_PAIN_RATE, DoNinjaPain, &s_NinjaPain[2][1]},
884     },
885     {
886     {NINJA_STAND_R3 + 0, NINJA_PAIN_RATE, DoNinjaPain, &s_NinjaPain[3][1]},
887     {NINJA_STAND_R3 + 0, NINJA_PAIN_RATE, DoNinjaPain, &s_NinjaPain[3][1]},
888     },
889     {
890     {NINJA_STAND_R4 + 0, NINJA_PAIN_RATE, DoNinjaPain, &s_NinjaPain[4][1]},
891     {NINJA_STAND_R4 + 0, NINJA_PAIN_RATE, DoNinjaPain, &s_NinjaPain[4][1]},
892     },
893     };
894 
895 STATEp sg_NinjaPain[] =
896     {
897     s_NinjaPain[0],
898     s_NinjaPain[1],
899     s_NinjaPain[2],
900     s_NinjaPain[3],
901     s_NinjaPain[4]
902     };
903 
904 //////////////////////
905 //
906 // NINJA STAR
907 //
908 //////////////////////
909 
910 #define NINJA_STAR_RATE 18
911 ANIMATOR InitEnemyStar;
912 
913 STATE s_NinjaStar[5][6] =
914     {
915     {
916     {NINJA_THROW_R0 + 0, NINJA_STAR_RATE * 2,     NullNinja,            &s_NinjaStar[0][1]},
917     {NINJA_THROW_R0 + 0, NINJA_STAR_RATE,       NullNinja,          &s_NinjaStar[0][2]},
918     {NINJA_THROW_R0 + 1, 0 | SF_QUICK_CALL,         InitEnemyStar,      &s_NinjaStar[0][3]},
919     {NINJA_THROW_R0 + 1, NINJA_STAR_RATE * 2,     NullNinja,            &s_NinjaStar[0][4]},
920     {NINJA_THROW_R0 + 2, 0 | SF_QUICK_CALL,         InitActorDecide,    &s_NinjaStar[0][5]},
921     {NINJA_THROW_R0 + 2, NINJA_STAR_RATE,       DoNinjaMove,        &s_NinjaStar[0][5]},
922     },
923     {
924     {NINJA_THROW_R1 + 0, NINJA_STAR_RATE * 2,     NullNinja,            &s_NinjaStar[1][1]},
925     {NINJA_THROW_R1 + 0, NINJA_STAR_RATE,       NullNinja,          &s_NinjaStar[1][2]},
926     {NINJA_THROW_R1 + 1, 0 | SF_QUICK_CALL,         InitEnemyStar,      &s_NinjaStar[1][3]},
927     {NINJA_THROW_R1 + 1, NINJA_STAR_RATE * 2,     NullNinja,            &s_NinjaStar[1][4]},
928     {NINJA_THROW_R1 + 2, 0 | SF_QUICK_CALL,         InitActorDecide,    &s_NinjaStar[1][5]},
929     {NINJA_THROW_R1 + 2, NINJA_STAR_RATE,       DoNinjaMove,        &s_NinjaStar[1][5]},
930     },
931     {
932     {NINJA_THROW_R2 + 0, NINJA_STAR_RATE * 2,     NullNinja,            &s_NinjaStar[2][1]},
933     {NINJA_THROW_R2 + 0, NINJA_STAR_RATE,       NullNinja,          &s_NinjaStar[2][2]},
934     {NINJA_THROW_R2 + 1, 0 | SF_QUICK_CALL,         InitEnemyStar,      &s_NinjaStar[2][3]},
935     {NINJA_THROW_R2 + 1, NINJA_STAR_RATE * 2,     NullNinja,            &s_NinjaStar[2][4]},
936     {NINJA_THROW_R2 + 2, 0 | SF_QUICK_CALL,         InitActorDecide,    &s_NinjaStar[2][5]},
937     {NINJA_THROW_R2 + 2, NINJA_STAR_RATE,       DoNinjaMove,        &s_NinjaStar[2][5]},
938     },
939     {
940     {NINJA_THROW_R2 + 0, NINJA_STAR_RATE * 2,     NullNinja,            &s_NinjaStar[3][1]},
941     {NINJA_THROW_R2 + 0, NINJA_STAR_RATE,       NullNinja,          &s_NinjaStar[3][2]},
942     {NINJA_THROW_R2 + 1, 0 | SF_QUICK_CALL,         InitEnemyStar,      &s_NinjaStar[3][3]},
943     {NINJA_THROW_R2 + 1, NINJA_STAR_RATE * 2,     NullNinja,            &s_NinjaStar[3][4]},
944     {NINJA_THROW_R2 + 2, 0 | SF_QUICK_CALL,         InitActorDecide,    &s_NinjaStar[3][5]},
945     {NINJA_THROW_R2 + 2, NINJA_STAR_RATE,       DoNinjaMove,        &s_NinjaStar[3][5]},
946     },
947     {
948     {NINJA_THROW_R2 + 0, NINJA_STAR_RATE * 2,     NullNinja,            &s_NinjaStar[4][1]},
949     {NINJA_THROW_R2 + 0, NINJA_STAR_RATE,       NullNinja,          &s_NinjaStar[4][2]},
950     {NINJA_THROW_R2 + 1, 0 | SF_QUICK_CALL,         InitEnemyStar,      &s_NinjaStar[4][3]},
951     {NINJA_THROW_R2 + 1, NINJA_STAR_RATE * 2,     NullNinja,            &s_NinjaStar[4][4]},
952     {NINJA_THROW_R2 + 2, 0 | SF_QUICK_CALL,         InitActorDecide,    &s_NinjaStar[4][5]},
953     {NINJA_THROW_R2 + 2, NINJA_STAR_RATE,       DoNinjaMove,        &s_NinjaStar[4][5]},
954     },
955     };
956 
957 STATEp sg_NinjaStar[] =
958     {
959     s_NinjaStar[0],
960     s_NinjaStar[1],
961     s_NinjaStar[2],
962     s_NinjaStar[3],
963     s_NinjaStar[4]
964     };
965 
966 //////////////////////
967 //
968 // NINJA MIRV
969 //
970 //////////////////////
971 
972 #define NINJA_MIRV_RATE 18
973 ANIMATOR InitEnemyMirv;
974 
975 STATE s_NinjaMirv[5][6] =
976     {
977     {
978     {NINJA_THROW_R0 + 0, NINJA_MIRV_RATE * 2, NullNinja, &s_NinjaMirv[0][1]},
979     {NINJA_THROW_R0 + 1, NINJA_MIRV_RATE, NullNinja, &s_NinjaMirv[0][2]},
980     {NINJA_THROW_R0 + 2, 0 | SF_QUICK_CALL, InitEnemyMirv, &s_NinjaMirv[0][3]},
981     {NINJA_THROW_R0 + 2, NINJA_MIRV_RATE * 2, NullNinja, &s_NinjaMirv[0][4]},
982     {NINJA_THROW_R0 + 2, 0 | SF_QUICK_CALL, InitActorDecide, &s_NinjaMirv[0][5]},
983     {NINJA_THROW_R0 + 2, NINJA_MIRV_RATE, DoNinjaMove, &s_NinjaMirv[0][5]},
984     },
985     {
986     {NINJA_THROW_R1 + 0, NINJA_MIRV_RATE * 2, NullNinja, &s_NinjaMirv[1][1]},
987     {NINJA_THROW_R1 + 1, NINJA_MIRV_RATE, NullNinja, &s_NinjaMirv[1][2]},
988     {NINJA_THROW_R1 + 2, 0 | SF_QUICK_CALL, InitEnemyMirv, &s_NinjaMirv[1][3]},
989     {NINJA_THROW_R1 + 2, NINJA_MIRV_RATE * 2, NullNinja, &s_NinjaMirv[1][4]},
990     {NINJA_THROW_R1 + 2, 0 | SF_QUICK_CALL, InitActorDecide, &s_NinjaMirv[1][5]},
991     {NINJA_THROW_R1 + 2, NINJA_MIRV_RATE, DoNinjaMove, &s_NinjaMirv[1][5]},
992     },
993     {
994     {NINJA_THROW_R2 + 0, NINJA_MIRV_RATE * 2, NullNinja, &s_NinjaMirv[2][1]},
995     {NINJA_THROW_R2 + 1, NINJA_MIRV_RATE, NullNinja, &s_NinjaMirv[2][2]},
996     {NINJA_THROW_R2 + 2, 0 | SF_QUICK_CALL, InitEnemyMirv, &s_NinjaMirv[2][3]},
997     {NINJA_THROW_R2 + 2, NINJA_MIRV_RATE * 2, NullNinja, &s_NinjaMirv[2][4]},
998     {NINJA_THROW_R2 + 2, 0 | SF_QUICK_CALL, InitActorDecide, &s_NinjaMirv[2][5]},
999     {NINJA_THROW_R2 + 2, NINJA_MIRV_RATE, DoNinjaMove, &s_NinjaMirv[2][5]},
1000     },
1001     {
1002     {NINJA_THROW_R2 + 0, NINJA_MIRV_RATE * 2, NullNinja, &s_NinjaMirv[3][1]},
1003     {NINJA_THROW_R2 + 1, NINJA_MIRV_RATE, NullNinja, &s_NinjaMirv[3][2]},
1004     {NINJA_THROW_R2 + 2, 0 | SF_QUICK_CALL, InitEnemyMirv, &s_NinjaMirv[3][3]},
1005     {NINJA_THROW_R2 + 2, NINJA_MIRV_RATE * 2, NullNinja, &s_NinjaMirv[3][4]},
1006     {NINJA_THROW_R2 + 2, 0 | SF_QUICK_CALL, InitActorDecide, &s_NinjaMirv[3][5]},
1007     {NINJA_THROW_R2 + 2, NINJA_MIRV_RATE, DoNinjaMove, &s_NinjaMirv[3][5]},
1008     },
1009     {
1010     {NINJA_THROW_R2 + 0, NINJA_MIRV_RATE * 2, NullNinja, &s_NinjaMirv[4][1]},
1011     {NINJA_THROW_R2 + 1, NINJA_MIRV_RATE, NullNinja, &s_NinjaMirv[4][2]},
1012     {NINJA_THROW_R2 + 2, 0 | SF_QUICK_CALL, InitEnemyMirv, &s_NinjaMirv[4][3]},
1013     {NINJA_THROW_R2 + 2, NINJA_MIRV_RATE * 2, NullNinja, &s_NinjaMirv[4][4]},
1014     {NINJA_THROW_R2 + 2, 0 | SF_QUICK_CALL, InitActorDecide, &s_NinjaMirv[4][5]},
1015     {NINJA_THROW_R2 + 2, NINJA_MIRV_RATE, DoNinjaMove, &s_NinjaStar[4][5]},
1016     },
1017     };
1018 
1019 
1020 STATEp sg_NinjaMirv[] =
1021     {
1022     s_NinjaMirv[0],
1023     s_NinjaMirv[1],
1024     s_NinjaMirv[2],
1025     s_NinjaMirv[3],
1026     s_NinjaMirv[4]
1027     };
1028 
1029 //////////////////////
1030 //
1031 // NINJA NAPALM
1032 //
1033 //////////////////////
1034 
1035 #define NINJA_NAPALM_RATE 18
1036 ANIMATOR InitEnemyNapalm;
1037 
1038 STATE s_NinjaNapalm[5][6] =
1039     {
1040     {
1041     {NINJA_THROW_R0 + 0, NINJA_NAPALM_RATE * 2, NullNinja, &s_NinjaNapalm[0][1]},
1042     {NINJA_THROW_R0 + 1, NINJA_NAPALM_RATE, NullNinja, &s_NinjaNapalm[0][2]},
1043     {NINJA_THROW_R0 + 2, 0 | SF_QUICK_CALL, InitEnemyNapalm, &s_NinjaNapalm[0][3]},
1044     {NINJA_THROW_R0 + 2, NINJA_NAPALM_RATE * 2, NullNinja, &s_NinjaNapalm[0][4]},
1045     {NINJA_THROW_R0 + 2, 0 | SF_QUICK_CALL, InitActorDecide, &s_NinjaNapalm[0][5]},
1046     {NINJA_THROW_R0 + 2, NINJA_NAPALM_RATE, DoNinjaMove, &s_NinjaNapalm[0][5]},
1047     },
1048     {
1049     {NINJA_THROW_R1 + 0, NINJA_NAPALM_RATE * 2, NullNinja, &s_NinjaNapalm[1][1]},
1050     {NINJA_THROW_R1 + 1, NINJA_NAPALM_RATE, NullNinja, &s_NinjaNapalm[1][2]},
1051     {NINJA_THROW_R1 + 2, 0 | SF_QUICK_CALL, InitEnemyNapalm, &s_NinjaNapalm[1][3]},
1052     {NINJA_THROW_R1 + 2, NINJA_NAPALM_RATE * 2, NullNinja, &s_NinjaNapalm[1][4]},
1053     {NINJA_THROW_R1 + 2, 0 | SF_QUICK_CALL, InitActorDecide, &s_NinjaNapalm[1][5]},
1054     {NINJA_THROW_R1 + 2, NINJA_NAPALM_RATE, DoNinjaMove, &s_NinjaNapalm[1][5]},
1055     },
1056     {
1057     {NINJA_THROW_R2 + 0, NINJA_NAPALM_RATE * 2, NullNinja, &s_NinjaNapalm[2][1]},
1058     {NINJA_THROW_R2 + 1, NINJA_NAPALM_RATE, NullNinja, &s_NinjaNapalm[2][2]},
1059     {NINJA_THROW_R2 + 2, 0 | SF_QUICK_CALL, InitEnemyNapalm, &s_NinjaNapalm[2][3]},
1060     {NINJA_THROW_R2 + 2, NINJA_NAPALM_RATE * 2, NullNinja, &s_NinjaNapalm[2][4]},
1061     {NINJA_THROW_R2 + 2, 0 | SF_QUICK_CALL, InitActorDecide, &s_NinjaNapalm[2][5]},
1062     {NINJA_THROW_R2 + 2, NINJA_NAPALM_RATE, DoNinjaMove, &s_NinjaNapalm[2][5]},
1063     },
1064     {
1065     {NINJA_THROW_R2 + 0, NINJA_NAPALM_RATE * 2, NullNinja, &s_NinjaNapalm[3][1]},
1066     {NINJA_THROW_R2 + 1, NINJA_NAPALM_RATE, NullNinja, &s_NinjaNapalm[3][2]},
1067     {NINJA_THROW_R2 + 2, 0 | SF_QUICK_CALL, InitEnemyNapalm, &s_NinjaNapalm[3][3]},
1068     {NINJA_THROW_R2 + 2, NINJA_NAPALM_RATE * 2, NullNinja, &s_NinjaNapalm[3][4]},
1069     {NINJA_THROW_R2 + 2, 0 | SF_QUICK_CALL, InitActorDecide, &s_NinjaNapalm[3][5]},
1070     {NINJA_THROW_R2 + 2, NINJA_NAPALM_RATE, DoNinjaMove, &s_NinjaNapalm[3][5]},
1071     },
1072     {
1073     {NINJA_THROW_R2 + 0, NINJA_NAPALM_RATE * 2, NullNinja, &s_NinjaNapalm[4][1]},
1074     {NINJA_THROW_R2 + 1, NINJA_NAPALM_RATE, NullNinja, &s_NinjaNapalm[4][2]},
1075     {NINJA_THROW_R2 + 2, 0 | SF_QUICK_CALL, InitEnemyNapalm, &s_NinjaNapalm[4][3]},
1076     {NINJA_THROW_R2 + 2, NINJA_NAPALM_RATE * 2, NullNinja, &s_NinjaNapalm[4][4]},
1077     {NINJA_THROW_R2 + 2, 0 | SF_QUICK_CALL, InitActorDecide, &s_NinjaNapalm[4][5]},
1078     {NINJA_THROW_R2 + 2, NINJA_NAPALM_RATE, DoNinjaMove, &s_NinjaNapalm[4][5]},
1079     },
1080     };
1081 
1082 
1083 STATEp sg_NinjaNapalm[] =
1084     {
1085     s_NinjaNapalm[0],
1086     s_NinjaNapalm[1],
1087     s_NinjaNapalm[2],
1088     s_NinjaNapalm[3],
1089     s_NinjaNapalm[4]
1090     };
1091 
1092 
1093 //////////////////////
1094 //
1095 // NINJA ROCKET
1096 //
1097 //////////////////////
1098 
1099 #define NINJA_ROCKET_RATE 14
1100 ANIMATOR InitEnemyRocket;
1101 
1102 STATE s_NinjaRocket[5][5] =
1103     {
1104     {
1105     {NINJA_STAND_R0 + 0, NINJA_ROCKET_RATE * 2, NullNinja, &s_NinjaRocket[0][1]},
1106     {NINJA_STAND_R0 + 0, 0 | SF_QUICK_CALL, InitEnemyRocket, &s_NinjaRocket[0][2]},
1107     {NINJA_STAND_R0 + 0, NINJA_ROCKET_RATE, NullNinja, &s_NinjaRocket[0][3]},
1108     {NINJA_STAND_R0 + 0, 0 | SF_QUICK_CALL, InitActorDecide, &s_NinjaRocket[0][4]},
1109     {NINJA_STAND_R0 + 0, NINJA_ROCKET_RATE, DoNinjaMove, &s_NinjaRocket[0][4]},
1110     },
1111     {
1112     {NINJA_STAND_R1 + 0, NINJA_ROCKET_RATE * 2, NullNinja, &s_NinjaRocket[1][1]},
1113     {NINJA_STAND_R1 + 0, 0 | SF_QUICK_CALL, InitEnemyRocket, &s_NinjaRocket[1][2]},
1114     {NINJA_STAND_R1 + 0, NINJA_ROCKET_RATE, NullNinja, &s_NinjaRocket[1][3]},
1115     {NINJA_STAND_R1 + 0, 0 | SF_QUICK_CALL, InitActorDecide, &s_NinjaRocket[1][4]},
1116     {NINJA_STAND_R1 + 0, NINJA_ROCKET_RATE, DoNinjaMove, &s_NinjaRocket[1][4]},
1117     },
1118     {
1119     {NINJA_STAND_R2 + 0, NINJA_ROCKET_RATE * 2, NullNinja, &s_NinjaRocket[2][1]},
1120     {NINJA_STAND_R2 + 0, 0 | SF_QUICK_CALL, InitEnemyRocket, &s_NinjaRocket[2][2]},
1121     {NINJA_STAND_R2 + 0, NINJA_ROCKET_RATE, NullNinja, &s_NinjaRocket[2][3]},
1122     {NINJA_STAND_R2 + 0, 0 | SF_QUICK_CALL, InitActorDecide, &s_NinjaRocket[2][4]},
1123     {NINJA_STAND_R2 + 0, NINJA_ROCKET_RATE, DoNinjaMove, &s_NinjaRocket[2][4]},
1124     },
1125     {
1126     {NINJA_STAND_R3 + 0, NINJA_ROCKET_RATE * 2, NullNinja, &s_NinjaRocket[3][1]},
1127     {NINJA_STAND_R3 + 0, 0 | SF_QUICK_CALL, InitEnemyRocket, &s_NinjaRocket[3][2]},
1128     {NINJA_STAND_R3 + 0, NINJA_ROCKET_RATE, NullNinja, &s_NinjaRocket[3][3]},
1129     {NINJA_STAND_R3 + 0, 0 | SF_QUICK_CALL, InitActorDecide, &s_NinjaRocket[3][4]},
1130     {NINJA_STAND_R3 + 0, NINJA_ROCKET_RATE, DoNinjaMove, &s_NinjaRocket[3][4]},
1131     },
1132     {
1133     {NINJA_STAND_R4 + 0, NINJA_ROCKET_RATE * 2, NullNinja, &s_NinjaRocket[4][1]},
1134     {NINJA_STAND_R4 + 0, 0 | SF_QUICK_CALL, InitEnemyRocket, &s_NinjaRocket[4][2]},
1135     {NINJA_STAND_R4 + 0, NINJA_ROCKET_RATE, NullNinja, &s_NinjaRocket[4][3]},
1136     {NINJA_STAND_R4 + 0, 0 | SF_QUICK_CALL, InitActorDecide, &s_NinjaRocket[4][4]},
1137     {NINJA_STAND_R4 + 0, NINJA_ROCKET_RATE, DoNinjaMove, &s_NinjaRocket[4][4]},
1138     },
1139     };
1140 
1141 
1142 STATEp sg_NinjaRocket[] =
1143     {
1144     s_NinjaRocket[0],
1145     s_NinjaRocket[1],
1146     s_NinjaRocket[2],
1147     s_NinjaRocket[3],
1148     s_NinjaRocket[4]
1149     };
1150 
1151 //////////////////////
1152 //
1153 // NINJA ROCKET
1154 //
1155 //////////////////////
1156 
1157 #define NINJA_ROCKET_RATE 14
1158 ANIMATOR InitSpriteGrenade;
1159 
1160 STATE s_NinjaGrenade[5][5] =
1161     {
1162     {
1163     {NINJA_STAND_R0 + 0, NINJA_ROCKET_RATE * 2, NullNinja, &s_NinjaGrenade[0][1]},
1164     {NINJA_STAND_R0 + 0, 0 | SF_QUICK_CALL, InitSpriteGrenade, &s_NinjaGrenade[0][2]},
1165     {NINJA_STAND_R0 + 0, NINJA_ROCKET_RATE, NullNinja, &s_NinjaGrenade[0][3]},
1166     {NINJA_STAND_R0 + 0, 0 | SF_QUICK_CALL, InitActorDecide, &s_NinjaGrenade[0][4]},
1167     {NINJA_STAND_R0 + 0, NINJA_ROCKET_RATE, DoNinjaMove, &s_NinjaGrenade[0][4]},
1168     },
1169     {
1170     {NINJA_STAND_R1 + 0, NINJA_ROCKET_RATE * 2, NullNinja, &s_NinjaGrenade[1][1]},
1171     {NINJA_STAND_R1 + 0, 0 | SF_QUICK_CALL, InitSpriteGrenade, &s_NinjaGrenade[1][2]},
1172     {NINJA_STAND_R1 + 0, NINJA_ROCKET_RATE, NullNinja, &s_NinjaGrenade[1][3]},
1173     {NINJA_STAND_R1 + 0, 0 | SF_QUICK_CALL, InitActorDecide, &s_NinjaGrenade[1][4]},
1174     {NINJA_STAND_R1 + 0, NINJA_ROCKET_RATE, DoNinjaMove, &s_NinjaGrenade[1][4]},
1175     },
1176     {
1177     {NINJA_STAND_R2 + 0, NINJA_ROCKET_RATE * 2, NullNinja, &s_NinjaGrenade[2][1]},
1178     {NINJA_STAND_R2 + 0, 0 | SF_QUICK_CALL, InitSpriteGrenade, &s_NinjaGrenade[2][2]},
1179     {NINJA_STAND_R2 + 0, NINJA_ROCKET_RATE, NullNinja, &s_NinjaGrenade[2][3]},
1180     {NINJA_STAND_R2 + 0, 0 | SF_QUICK_CALL, InitActorDecide, &s_NinjaGrenade[2][4]},
1181     {NINJA_STAND_R2 + 0, NINJA_ROCKET_RATE, DoNinjaMove, &s_NinjaGrenade[2][4]},
1182     },
1183     {
1184     {NINJA_STAND_R3 + 0, NINJA_ROCKET_RATE * 2, NullNinja, &s_NinjaGrenade[3][1]},
1185     {NINJA_STAND_R3 + 0, 0 | SF_QUICK_CALL, InitSpriteGrenade, &s_NinjaGrenade[3][2]},
1186     {NINJA_STAND_R3 + 0, NINJA_ROCKET_RATE, NullNinja, &s_NinjaGrenade[3][3]},
1187     {NINJA_STAND_R3 + 0, 0 | SF_QUICK_CALL, InitActorDecide, &s_NinjaGrenade[3][4]},
1188     {NINJA_STAND_R3 + 0, NINJA_ROCKET_RATE, DoNinjaMove, &s_NinjaGrenade[3][4]},
1189     },
1190     {
1191     {NINJA_STAND_R4 + 0, NINJA_ROCKET_RATE * 2, NullNinja, &s_NinjaGrenade[4][1]},
1192     {NINJA_STAND_R4 + 0, 0 | SF_QUICK_CALL, InitSpriteGrenade, &s_NinjaGrenade[4][2]},
1193     {NINJA_STAND_R4 + 0, NINJA_ROCKET_RATE, NullNinja, &s_NinjaGrenade[4][3]},
1194     {NINJA_STAND_R4 + 0, 0 | SF_QUICK_CALL, InitActorDecide, &s_NinjaGrenade[4][4]},
1195     {NINJA_STAND_R4 + 0, NINJA_ROCKET_RATE, DoNinjaMove, &s_NinjaGrenade[4][4]},
1196     },
1197     };
1198 
1199 
1200 STATEp sg_NinjaGrenade[] =
1201     {
1202     s_NinjaGrenade[0],
1203     s_NinjaGrenade[1],
1204     s_NinjaGrenade[2],
1205     s_NinjaGrenade[3],
1206     s_NinjaGrenade[4]
1207     };
1208 
1209 
1210 //////////////////////
1211 //
1212 // NINJA FLASHBOMB
1213 //
1214 //////////////////////
1215 
1216 #define NINJA_FLASHBOMB_RATE 14
1217 ANIMATOR InitFlashBomb;
1218 
1219 STATE s_NinjaFlashBomb[5][5] =
1220     {
1221     {
1222     {NINJA_STAND_R0 + 0, NINJA_FLASHBOMB_RATE * 2, NullNinja, &s_NinjaFlashBomb[0][1]},
1223     {NINJA_STAND_R0 + 0, 0 | SF_QUICK_CALL, InitFlashBomb, &s_NinjaFlashBomb[0][2]},
1224     {NINJA_STAND_R0 + 0, NINJA_FLASHBOMB_RATE, NullNinja, &s_NinjaFlashBomb[0][3]},
1225     {NINJA_STAND_R0 + 0, 0 | SF_QUICK_CALL, InitActorDecide, &s_NinjaFlashBomb[0][4]},
1226     {NINJA_STAND_R0 + 0, NINJA_FLASHBOMB_RATE, DoNinjaMove, &s_NinjaFlashBomb[0][4]},
1227     },
1228     {
1229     {NINJA_STAND_R1 + 0, NINJA_FLASHBOMB_RATE * 2, NullNinja, &s_NinjaFlashBomb[1][1]},
1230     {NINJA_STAND_R1 + 0, 0 | SF_QUICK_CALL, InitFlashBomb, &s_NinjaFlashBomb[1][2]},
1231     {NINJA_STAND_R1 + 0, NINJA_FLASHBOMB_RATE, NullNinja, &s_NinjaFlashBomb[1][3]},
1232     {NINJA_STAND_R1 + 0, 0 | SF_QUICK_CALL, InitActorDecide, &s_NinjaFlashBomb[1][4]},
1233     {NINJA_STAND_R1 + 0, NINJA_FLASHBOMB_RATE, DoNinjaMove, &s_NinjaFlashBomb[1][4]},
1234     },
1235     {
1236     {NINJA_STAND_R2 + 0, NINJA_FLASHBOMB_RATE * 2, NullNinja, &s_NinjaFlashBomb[2][1]},
1237     {NINJA_STAND_R2 + 0, 0 | SF_QUICK_CALL, InitFlashBomb, &s_NinjaFlashBomb[2][2]},
1238     {NINJA_STAND_R2 + 0, NINJA_FLASHBOMB_RATE, NullNinja, &s_NinjaFlashBomb[2][3]},
1239     {NINJA_STAND_R2 + 0, 0 | SF_QUICK_CALL, InitActorDecide, &s_NinjaFlashBomb[2][4]},
1240     {NINJA_STAND_R2 + 0, NINJA_FLASHBOMB_RATE, DoNinjaMove, &s_NinjaFlashBomb[2][4]},
1241     },
1242     {
1243     {NINJA_STAND_R3 + 0, NINJA_FLASHBOMB_RATE * 2, NullNinja, &s_NinjaFlashBomb[3][1]},
1244     {NINJA_STAND_R3 + 0, 0 | SF_QUICK_CALL, InitFlashBomb, &s_NinjaFlashBomb[3][2]},
1245     {NINJA_STAND_R3 + 0, NINJA_FLASHBOMB_RATE, NullNinja, &s_NinjaFlashBomb[3][3]},
1246     {NINJA_STAND_R3 + 0, 0 | SF_QUICK_CALL, InitActorDecide, &s_NinjaFlashBomb[3][4]},
1247     {NINJA_STAND_R3 + 0, NINJA_FLASHBOMB_RATE, DoNinjaMove, &s_NinjaFlashBomb[3][4]},
1248     },
1249     {
1250     {NINJA_STAND_R4 + 0, NINJA_FLASHBOMB_RATE * 2, NullNinja, &s_NinjaFlashBomb[4][1]},
1251     {NINJA_STAND_R4 + 0, 0 | SF_QUICK_CALL, InitFlashBomb, &s_NinjaFlashBomb[4][2]},
1252     {NINJA_STAND_R4 + 0, NINJA_FLASHBOMB_RATE, NullNinja, &s_NinjaFlashBomb[4][3]},
1253     {NINJA_STAND_R4 + 0, 0 | SF_QUICK_CALL, InitActorDecide, &s_NinjaFlashBomb[4][4]},
1254     {NINJA_STAND_R4 + 0, NINJA_FLASHBOMB_RATE, DoNinjaMove, &s_NinjaFlashBomb[4][4]},
1255     },
1256     };
1257 
1258 
1259 STATEp sg_NinjaFlashBomb[] =
1260     {
1261     s_NinjaFlashBomb[0],
1262     s_NinjaFlashBomb[1],
1263     s_NinjaFlashBomb[2],
1264     s_NinjaFlashBomb[3],
1265     s_NinjaFlashBomb[4]
1266     };
1267 
1268 //////////////////////
1269 //
1270 // NINJA UZI
1271 //
1272 //////////////////////
1273 
1274 #define NINJA_UZI_RATE 8
1275 ANIMATOR InitEnemyUzi,CheckFire;
1276 
1277 STATE s_NinjaUzi[5][17] =
1278     {
1279     {
1280     {NINJA_FIRE_R0 + 0, NINJA_UZI_RATE, NullNinja, &s_NinjaUzi[0][1]},
1281     {NINJA_FIRE_R0 + 0, 0 | SF_QUICK_CALL, CheckFire, &s_NinjaUzi[0][2]},
1282     {NINJA_FIRE_R0 + 1, NINJA_UZI_RATE, NullNinja, &s_NinjaUzi[0][3]},
1283     {NINJA_FIRE_R0 + 1, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_NinjaUzi[0][4]},
1284     {NINJA_FIRE_R0 + 0, NINJA_UZI_RATE, NullNinja, &s_NinjaUzi[0][5]},
1285     {NINJA_FIRE_R0 + 0, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_NinjaUzi[0][6]},
1286     {NINJA_FIRE_R0 + 1, NINJA_UZI_RATE, NullNinja, &s_NinjaUzi[0][7]},
1287     {NINJA_FIRE_R0 + 1, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_NinjaUzi[0][8]},
1288     {NINJA_FIRE_R0 + 0, NINJA_UZI_RATE, NullNinja, &s_NinjaUzi[0][9]},
1289     {NINJA_FIRE_R0 + 0, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_NinjaUzi[0][10]},
1290     {NINJA_FIRE_R0 + 1, NINJA_UZI_RATE, NullNinja, &s_NinjaUzi[0][11]},
1291     {NINJA_FIRE_R0 + 1, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_NinjaUzi[0][12]},
1292     {NINJA_FIRE_R0 + 0, NINJA_UZI_RATE, NullNinja, &s_NinjaUzi[0][13]},
1293     {NINJA_FIRE_R0 + 0, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_NinjaUzi[0][14]},
1294     {NINJA_FIRE_R0 + 1, NINJA_UZI_RATE, NullNinja, &s_NinjaUzi[0][15]},
1295     {NINJA_FIRE_R0 + 1, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_NinjaUzi[0][16]},
1296     {NINJA_FIRE_R0 + 0, 0 | SF_QUICK_CALL, InitActorDecide, &s_NinjaUzi[0][16]},
1297     },
1298     {
1299     {NINJA_FIRE_R1 + 0, NINJA_UZI_RATE, NullNinja, &s_NinjaUzi[1][1]},
1300     {NINJA_FIRE_R1 + 0, 0 | SF_QUICK_CALL, CheckFire, &s_NinjaUzi[1][2]},
1301     {NINJA_FIRE_R1 + 1, NINJA_UZI_RATE, NullNinja, &s_NinjaUzi[1][3]},
1302     {NINJA_FIRE_R1 + 1, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_NinjaUzi[1][4]},
1303     {NINJA_FIRE_R1 + 0, NINJA_UZI_RATE, NullNinja, &s_NinjaUzi[1][5]},
1304     {NINJA_FIRE_R1 + 0, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_NinjaUzi[1][6]},
1305     {NINJA_FIRE_R1 + 1, NINJA_UZI_RATE, NullNinja, &s_NinjaUzi[1][7]},
1306     {NINJA_FIRE_R1 + 1, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_NinjaUzi[1][8]},
1307     {NINJA_FIRE_R1 + 0, NINJA_UZI_RATE, NullNinja, &s_NinjaUzi[1][9]},
1308     {NINJA_FIRE_R1 + 0, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_NinjaUzi[1][10]},
1309     {NINJA_FIRE_R1 + 1, NINJA_UZI_RATE, NullNinja, &s_NinjaUzi[1][11]},
1310     {NINJA_FIRE_R1 + 1, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_NinjaUzi[1][12]},
1311     {NINJA_FIRE_R1 + 0, NINJA_UZI_RATE, NullNinja, &s_NinjaUzi[1][13]},
1312     {NINJA_FIRE_R1 + 0, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_NinjaUzi[1][14]},
1313     {NINJA_FIRE_R1 + 1, NINJA_UZI_RATE, NullNinja, &s_NinjaUzi[1][15]},
1314     {NINJA_FIRE_R1 + 1, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_NinjaUzi[1][16]},
1315     {NINJA_FIRE_R1 + 0, 0 | SF_QUICK_CALL, InitActorDecide, &s_NinjaUzi[1][16]},
1316     },
1317     {
1318     {NINJA_FIRE_R2 + 0, NINJA_UZI_RATE, NullNinja, &s_NinjaUzi[2][1]},
1319     {NINJA_FIRE_R2 + 0, 0 | SF_QUICK_CALL, CheckFire, &s_NinjaUzi[2][2]},
1320     {NINJA_FIRE_R2 + 1, NINJA_UZI_RATE, NullNinja, &s_NinjaUzi[2][3]},
1321     {NINJA_FIRE_R2 + 1, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_NinjaUzi[2][4]},
1322     {NINJA_FIRE_R2 + 0, NINJA_UZI_RATE, NullNinja, &s_NinjaUzi[2][5]},
1323     {NINJA_FIRE_R2 + 0, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_NinjaUzi[2][6]},
1324     {NINJA_FIRE_R2 + 1, NINJA_UZI_RATE, NullNinja, &s_NinjaUzi[2][7]},
1325     {NINJA_FIRE_R2 + 1, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_NinjaUzi[2][8]},
1326     {NINJA_FIRE_R2 + 0, NINJA_UZI_RATE, NullNinja, &s_NinjaUzi[2][9]},
1327     {NINJA_FIRE_R2 + 0, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_NinjaUzi[2][10]},
1328     {NINJA_FIRE_R2 + 1, NINJA_UZI_RATE, NullNinja, &s_NinjaUzi[2][11]},
1329     {NINJA_FIRE_R2 + 1, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_NinjaUzi[2][12]},
1330     {NINJA_FIRE_R2 + 0, NINJA_UZI_RATE, NullNinja, &s_NinjaUzi[2][13]},
1331     {NINJA_FIRE_R2 + 0, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_NinjaUzi[2][14]},
1332     {NINJA_FIRE_R2 + 1, NINJA_UZI_RATE, NullNinja, &s_NinjaUzi[2][15]},
1333     {NINJA_FIRE_R2 + 1, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_NinjaUzi[2][16]},
1334     {NINJA_FIRE_R2 + 0, 0 | SF_QUICK_CALL, InitActorDecide, &s_NinjaUzi[2][16]},
1335     },
1336     {
1337     {NINJA_FIRE_R3 + 0, NINJA_UZI_RATE, NullNinja, &s_NinjaUzi[3][1]},
1338     {NINJA_FIRE_R3 + 0, 0 | SF_QUICK_CALL, CheckFire, &s_NinjaUzi[3][2]},
1339     {NINJA_FIRE_R3 + 1, NINJA_UZI_RATE, NullNinja, &s_NinjaUzi[3][3]},
1340     {NINJA_FIRE_R3 + 1, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_NinjaUzi[3][4]},
1341     {NINJA_FIRE_R3 + 0, NINJA_UZI_RATE, NullNinja, &s_NinjaUzi[3][5]},
1342     {NINJA_FIRE_R3 + 0, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_NinjaUzi[3][6]},
1343     {NINJA_FIRE_R3 + 1, NINJA_UZI_RATE, NullNinja, &s_NinjaUzi[3][7]},
1344     {NINJA_FIRE_R3 + 1, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_NinjaUzi[3][8]},
1345     {NINJA_FIRE_R3 + 0, NINJA_UZI_RATE, NullNinja, &s_NinjaUzi[3][9]},
1346     {NINJA_FIRE_R3 + 0, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_NinjaUzi[3][10]},
1347     {NINJA_FIRE_R3 + 1, NINJA_UZI_RATE, NullNinja, &s_NinjaUzi[3][11]},
1348     {NINJA_FIRE_R3 + 1, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_NinjaUzi[3][12]},
1349     {NINJA_FIRE_R3 + 0, NINJA_UZI_RATE, NullNinja, &s_NinjaUzi[3][13]},
1350     {NINJA_FIRE_R3 + 0, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_NinjaUzi[3][14]},
1351     {NINJA_FIRE_R3 + 1, NINJA_UZI_RATE, NullNinja, &s_NinjaUzi[3][15]},
1352     {NINJA_FIRE_R3 + 1, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_NinjaUzi[3][16]},
1353     {NINJA_FIRE_R3 + 0, 0 | SF_QUICK_CALL, InitActorDecide, &s_NinjaUzi[3][16]},
1354     },
1355     {
1356     {NINJA_FIRE_R4 + 0, NINJA_UZI_RATE, NullNinja, &s_NinjaUzi[4][1]},
1357     {NINJA_FIRE_R4 + 0, 0 | SF_QUICK_CALL, CheckFire, &s_NinjaUzi[4][2]},
1358     {NINJA_FIRE_R4 + 1, NINJA_UZI_RATE, NullNinja, &s_NinjaUzi[4][3]},
1359     {NINJA_FIRE_R4 + 1, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_NinjaUzi[4][4]},
1360     {NINJA_FIRE_R4 + 0, NINJA_UZI_RATE, NullNinja, &s_NinjaUzi[4][5]},
1361     {NINJA_FIRE_R4 + 0, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_NinjaUzi[4][6]},
1362     {NINJA_FIRE_R4 + 1, NINJA_UZI_RATE, NullNinja, &s_NinjaUzi[4][7]},
1363     {NINJA_FIRE_R4 + 1, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_NinjaUzi[4][8]},
1364     {NINJA_FIRE_R4 + 0, NINJA_UZI_RATE, NullNinja, &s_NinjaUzi[4][9]},
1365     {NINJA_FIRE_R4 + 0, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_NinjaUzi[4][10]},
1366     {NINJA_FIRE_R4 + 1, NINJA_UZI_RATE, NullNinja, &s_NinjaUzi[4][11]},
1367     {NINJA_FIRE_R4 + 1, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_NinjaUzi[4][12]},
1368     {NINJA_FIRE_R4 + 0, NINJA_UZI_RATE, NullNinja, &s_NinjaUzi[4][13]},
1369     {NINJA_FIRE_R4 + 0, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_NinjaUzi[4][14]},
1370     {NINJA_FIRE_R4 + 1, NINJA_UZI_RATE, NullNinja, &s_NinjaUzi[4][15]},
1371     {NINJA_FIRE_R4 + 1, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_NinjaUzi[4][16]},
1372     {NINJA_FIRE_R4 + 0, 0 | SF_QUICK_CALL, InitActorDecide, &s_NinjaUzi[4][16]},
1373     },
1374     };
1375 
1376 
1377 STATEp sg_NinjaUzi[] =
1378     {
1379     s_NinjaUzi[0],
1380     s_NinjaUzi[1],
1381     s_NinjaUzi[2],
1382     s_NinjaUzi[3],
1383     s_NinjaUzi[4]
1384     };
1385 
1386 
1387 //////////////////////
1388 //
1389 // NINJA HARI KARI
1390 //
1391 //////////////////////
1392 
1393 #define NINJA_HARI_KARI_WAIT_RATE 200
1394 #define NINJA_HARI_KARI_FALL_RATE 16
1395 ANIMATOR DoHariKariBlood;
1396 ANIMATOR DoNinjaSpecial;
1397 
1398 STATE s_NinjaHariKari[] =
1399     {
1400     {NINJA_HARI_KARI_R0 + 0,   NINJA_HARI_KARI_FALL_RATE,      NullNinja,       &s_NinjaHariKari[1]},
1401     {NINJA_HARI_KARI_R0 + 0,   SF_QUICK_CALL,                  DoNinjaSpecial,       &s_NinjaHariKari[2]},
1402     {NINJA_HARI_KARI_R0 + 1,   NINJA_HARI_KARI_WAIT_RATE,      NullNinja,       &s_NinjaHariKari[3]},
1403     {NINJA_HARI_KARI_R0 + 2,   SF_QUICK_CALL,                  DoNinjaHariKari, &s_NinjaHariKari[4]},
1404     {NINJA_HARI_KARI_R0 + 2,   NINJA_HARI_KARI_FALL_RATE,      NullAnimator,       &s_NinjaHariKari[5]},
1405     {NINJA_HARI_KARI_R0 + 3,   NINJA_HARI_KARI_FALL_RATE,      NullAnimator,       &s_NinjaHariKari[6]},
1406     {NINJA_HARI_KARI_R0 + 4,   NINJA_HARI_KARI_FALL_RATE,      NullAnimator,       &s_NinjaHariKari[7]},
1407     {NINJA_HARI_KARI_R0 + 5,   NINJA_HARI_KARI_FALL_RATE,      NullAnimator,       &s_NinjaHariKari[8]},
1408     {NINJA_HARI_KARI_R0 + 6,   NINJA_HARI_KARI_FALL_RATE,      NullAnimator,       &s_NinjaHariKari[9]},
1409     {NINJA_HARI_KARI_R0 + 7,   NINJA_HARI_KARI_FALL_RATE,      NullAnimator,       &s_NinjaHariKari[10]},
1410     {NINJA_HARI_KARI_R0 + 7,   NINJA_HARI_KARI_FALL_RATE,      NullAnimator,       &s_NinjaHariKari[10]},
1411     };
1412 
1413 STATEp sg_NinjaHariKari[] =
1414     {
1415     s_NinjaHariKari,
1416     s_NinjaHariKari,
1417     s_NinjaHariKari,
1418     s_NinjaHariKari,
1419     s_NinjaHariKari
1420     };
1421 
1422 
1423 //////////////////////
1424 //
1425 // NINJA GRAB THROAT
1426 //
1427 //////////////////////
1428 
1429 #define NINJA_GRAB_THROAT_RATE 32
1430 #define NINJA_GRAB_THROAT_R0 4237
1431 ANIMATOR DoNinjaGrabThroat;
1432 
1433 STATE s_NinjaGrabThroat[] =
1434     {
1435     {NINJA_GRAB_THROAT_R0 + 0,   NINJA_GRAB_THROAT_RATE,      NullNinja,       &s_NinjaGrabThroat[1]},
1436     {NINJA_GRAB_THROAT_R0 + 0,   SF_QUICK_CALL,               DoNinjaSpecial,  &s_NinjaGrabThroat[2]},
1437     {NINJA_GRAB_THROAT_R0 + 1,   NINJA_GRAB_THROAT_RATE,      NullNinja,       &s_NinjaGrabThroat[3]},
1438     {NINJA_GRAB_THROAT_R0 + 2,   SF_QUICK_CALL,               DoNinjaGrabThroat, &s_NinjaGrabThroat[4]},
1439     {NINJA_GRAB_THROAT_R0 + 2,   NINJA_GRAB_THROAT_RATE,      NullNinja,       &s_NinjaGrabThroat[5]},
1440     {NINJA_GRAB_THROAT_R0 + 1,   NINJA_GRAB_THROAT_RATE,      NullNinja,       &s_NinjaGrabThroat[0]},
1441     };
1442 
1443 STATEp sg_NinjaGrabThroat[] =
1444     {
1445     s_NinjaGrabThroat,
1446     s_NinjaGrabThroat,
1447     s_NinjaGrabThroat,
1448     s_NinjaGrabThroat,
1449     s_NinjaGrabThroat
1450     };
1451 
1452 
1453 //////////////////////
1454 //
1455 // NINJA DIE
1456 //
1457 //////////////////////
1458 
1459 #define NINJA_DIE_RATE 14
1460 
1461 STATE s_NinjaDie[] =
1462     {
1463     {NINJA_DIE + 0, NINJA_DIE_RATE, NullNinja, &s_NinjaDie[1]},
1464     {NINJA_DIE + 1, NINJA_DIE_RATE, NullNinja, &s_NinjaDie[2]},
1465     {NINJA_DIE + 2, NINJA_DIE_RATE, NullNinja, &s_NinjaDie[3]},
1466     {NINJA_DIE + 3, NINJA_DIE_RATE, NullNinja, &s_NinjaDie[4]},
1467     {NINJA_DIE + 4, NINJA_DIE_RATE, NullNinja, &s_NinjaDie[5]},
1468     {NINJA_DIE + 5, NINJA_DIE_RATE-4, NullNinja, &s_NinjaDie[6]},
1469     {NINJA_DIE + 6, NINJA_DIE_RATE-6, NullNinja, &s_NinjaDie[7]},
1470     {NINJA_DIE + 6, SF_QUICK_CALL , DoNinjaSpecial, &s_NinjaDie[8]},
1471     {NINJA_DIE + 6, NINJA_DIE_RATE-10, NullNinja, &s_NinjaDie[9]},
1472     {NINJA_DIE + 7, SF_QUICK_CALL , QueueFloorBlood, &s_NinjaDie[10]},
1473     {NINJA_DIE + 7, NINJA_DIE_RATE-12, DoActorDebris, &s_NinjaDie[10]},
1474     };
1475 
1476 
1477 #define NINJA_DIESLICED_RATE 20
1478 ANIMATOR DoCutInHalf;
1479 
1480 STATE s_NinjaDieSliced[] =
1481     {
1482     {NINJA_SLICED + 0, NINJA_DIESLICED_RATE*6, NullNinja, &s_NinjaDieSliced[1]},
1483     {NINJA_SLICED + 1, NINJA_DIESLICED_RATE,   NullNinja, &s_NinjaDieSliced[2]},
1484     {NINJA_SLICED + 2, NINJA_DIESLICED_RATE,   NullNinja, &s_NinjaDieSliced[3]},
1485     {NINJA_SLICED + 3, NINJA_DIESLICED_RATE,   NullNinja, &s_NinjaDieSliced[4]},
1486     {NINJA_SLICED + 4, NINJA_DIESLICED_RATE-1, NullNinja, &s_NinjaDieSliced[5]},
1487     {NINJA_SLICED + 5, NINJA_DIESLICED_RATE-2, NullNinja, &s_NinjaDieSliced[6]},
1488     {NINJA_SLICED + 6, NINJA_DIESLICED_RATE-3, NullNinja, &s_NinjaDieSliced[7]},
1489     {NINJA_SLICED + 7, NINJA_DIESLICED_RATE-4, NullNinja, &s_NinjaDieSliced[8]},
1490     {NINJA_SLICED + 7, SF_QUICK_CALL        , DoNinjaSpecial, &s_NinjaDieSliced[9]},
1491     {NINJA_SLICED + 8, NINJA_DIESLICED_RATE-5, NullNinja, &s_NinjaDieSliced[10]},
1492     {NINJA_SLICED + 9, SF_QUICK_CALL         , QueueFloorBlood, &s_NinjaDieSliced[11]},
1493     {NINJA_SLICED + 9, NINJA_DIESLICED_RATE , DoActorDebris, &s_NinjaDieSliced[11]},
1494     };
1495 
1496 STATE s_NinjaDead[] =
1497     {
1498     {NINJA_DIE + 5, NINJA_DIE_RATE, DoActorDebris, &s_NinjaDead[1]},
1499     {NINJA_DIE + 6, SF_QUICK_CALL , DoNinjaSpecial, &s_NinjaDead[2]},
1500     {NINJA_DIE + 6, NINJA_DIE_RATE, DoActorDebris, &s_NinjaDead[3]},
1501     {NINJA_DIE + 7, SF_QUICK_CALL , QueueFloorBlood,&s_NinjaDead[4]},
1502     {NINJA_DIE + 7, NINJA_DIE_RATE, DoActorDebris, &s_NinjaDead[4]},
1503     };
1504 
1505 
1506 STATE s_NinjaDeathJump[] =
1507     {
1508     {NINJA_DIE + 0, NINJA_DIE_RATE, DoActorDeathMove, &s_NinjaDeathJump[1]},
1509     {NINJA_DIE + 1, NINJA_DIE_RATE, DoActorDeathMove, &s_NinjaDeathJump[2]},
1510     {NINJA_DIE + 2, NINJA_DIE_RATE, DoActorDeathMove, &s_NinjaDeathJump[2]},
1511     };
1512 
1513 STATE s_NinjaDeathFall[] =
1514     {
1515     {NINJA_DIE + 3, NINJA_DIE_RATE, DoActorDeathMove, &s_NinjaDeathFall[1]},
1516     {NINJA_DIE + 4, NINJA_DIE_RATE, DoActorDeathMove, &s_NinjaDeathFall[1]},
1517     };
1518 
1519 /*
1520 STATEp *Stand[MAX_WEAPONS];
1521 STATEp *Run;
1522 STATEp *Jump;
1523 STATEp *Fall;
1524 STATEp *Crawl;
1525 STATEp *Swim;
1526 STATEp *Fly;
1527 STATEp *Rise;
1528 STATEp *Sit;
1529 STATEp *Look;
1530 STATEp *Climb;
1531 STATEp *Pain;
1532 STATEp *Death1;
1533 STATEp *Death2;
1534 STATEp *Dead;
1535 STATEp *DeathJump;
1536 STATEp *DeathFall;
1537 STATEp *CloseAttack[2];
1538 STATEp *Attack[6];
1539 STATEp *Special[2];
1540 */
1541 
1542 STATEp sg_NinjaDie[] =
1543     {
1544     s_NinjaDie
1545     };
1546 
1547 STATEp sg_NinjaDieSliced[] =
1548     {
1549     s_NinjaDieSliced
1550     };
1551 
1552 STATEp sg_NinjaDead[] =
1553     {
1554     s_NinjaDead
1555     };
1556 
1557 STATEp sg_NinjaDeathJump[] =
1558     {
1559     s_NinjaDeathJump
1560     };
1561 
1562 STATEp sg_NinjaDeathFall[] =
1563     {
1564     s_NinjaDeathFall
1565     };
1566 
1567 /*
1568 
1569  !AIC - Collection of states that connect action to states
1570 
1571 */
1572 
1573 ACTOR_ACTION_SET NinjaSniperActionSet =
1574     {
1575     sg_NinjaDuck,
1576     sg_NinjaCrawl,
1577     sg_NinjaJump,
1578     sg_NinjaFall,
1579     sg_NinjaKneelCrawl,
1580     sg_NinjaSwim,
1581     sg_NinjaFly,
1582     sg_NinjaUzi,
1583     sg_NinjaDuck,
1584     NULL,
1585     sg_NinjaClimb,
1586     sg_NinjaPain,
1587     sg_NinjaDie,
1588     sg_NinjaHariKari,
1589     sg_NinjaDead,
1590     sg_NinjaDeathJump,
1591     sg_NinjaDeathFall,
1592     {sg_NinjaUzi},
1593     {1024},
1594     {sg_NinjaUzi},
1595     {1024},
1596     {NULL},
1597     sg_NinjaDuck,
1598     sg_NinjaDive
1599     };
1600 
1601 ACTOR_ACTION_SET NinjaActionSet =
1602     {
1603     sg_NinjaStand,
1604     sg_NinjaRun,
1605     sg_NinjaJump,
1606     sg_NinjaFall,
1607     sg_NinjaKneelCrawl,
1608     sg_NinjaSwim,
1609     sg_NinjaFly,
1610     sg_NinjaRise,
1611     sg_NinjaSit,
1612     NULL,
1613     sg_NinjaClimb,
1614     sg_NinjaPain,
1615     sg_NinjaDie,
1616     sg_NinjaHariKari,
1617     sg_NinjaDead,
1618     sg_NinjaDeathJump,
1619     sg_NinjaDeathFall,
1620     {sg_NinjaUzi, sg_NinjaStar},
1621     {1000, 1024},
1622     {sg_NinjaUzi, sg_NinjaStar},
1623     {800, 1024},
1624     {NULL},
1625     sg_NinjaDuck,
1626     sg_NinjaDive
1627     };
1628 
1629 ACTOR_ACTION_SET NinjaRedActionSet =
1630     {
1631     sg_NinjaStand,
1632     sg_NinjaRun,
1633     sg_NinjaJump,
1634     sg_NinjaFall,
1635     sg_NinjaKneelCrawl,
1636     sg_NinjaSwim,
1637     sg_NinjaFly,
1638     sg_NinjaRise,
1639     sg_NinjaSit,
1640     NULL,
1641     sg_NinjaClimb,
1642     sg_NinjaPain,
1643     sg_NinjaDie,
1644     sg_NinjaHariKari,
1645     sg_NinjaDead,
1646     sg_NinjaDeathJump,
1647     sg_NinjaDeathFall,
1648     {sg_NinjaUzi, sg_NinjaUzi},
1649     {812, 1024},
1650     {sg_NinjaUzi, sg_NinjaRocket},
1651     {812, 1024},
1652     {NULL},
1653     sg_NinjaDuck,
1654     sg_NinjaDive
1655     };
1656 
1657 ACTOR_ACTION_SET NinjaSeekerActionSet =
1658     {
1659     sg_NinjaStand,
1660     sg_NinjaRun,
1661     sg_NinjaJump,
1662     sg_NinjaFall,
1663     sg_NinjaKneelCrawl,
1664     sg_NinjaSwim,
1665     sg_NinjaFly,
1666     sg_NinjaRise,
1667     sg_NinjaSit,
1668     NULL,
1669     sg_NinjaClimb,
1670     sg_NinjaPain,
1671     sg_NinjaDie,
1672     sg_NinjaHariKari,
1673     sg_NinjaDead,
1674     sg_NinjaDeathJump,
1675     sg_NinjaDeathFall,
1676     {sg_NinjaUzi, sg_NinjaStar},
1677     {812, 1024},
1678     {sg_NinjaUzi, sg_NinjaRocket},
1679     {812, 1024},
1680     {NULL},
1681     sg_NinjaDuck,
1682     sg_NinjaDive
1683     };
1684 
1685 ACTOR_ACTION_SET NinjaGrenadeActionSet =
1686     {
1687     sg_NinjaStand,
1688     sg_NinjaRun,
1689     sg_NinjaJump,
1690     sg_NinjaFall,
1691     sg_NinjaKneelCrawl,
1692     sg_NinjaSwim,
1693     sg_NinjaFly,
1694     sg_NinjaRise,
1695     sg_NinjaSit,
1696     NULL,
1697     sg_NinjaClimb,
1698     sg_NinjaPain,
1699     sg_NinjaDie,
1700     sg_NinjaHariKari,
1701     sg_NinjaDead,
1702     sg_NinjaDeathJump,
1703     sg_NinjaDeathFall,
1704     {sg_NinjaUzi, sg_NinjaUzi},
1705     {812, 1024},
1706     {sg_NinjaUzi, sg_NinjaGrenade},
1707     {812, 1024},
1708     {NULL},
1709     sg_NinjaDuck,
1710     sg_NinjaDive
1711     };
1712 
1713 ACTOR_ACTION_SET NinjaGreenActionSet =
1714     {
1715     sg_NinjaStand,
1716     sg_NinjaRun,
1717     sg_NinjaJump,
1718     sg_NinjaFall,
1719     sg_NinjaKneelCrawl,
1720     sg_NinjaSwim,
1721     sg_NinjaFly,
1722     sg_NinjaRise,
1723     sg_NinjaSit,
1724     NULL,
1725     sg_NinjaClimb,
1726     sg_NinjaPain,
1727     sg_NinjaDie,
1728     sg_NinjaHariKari,
1729     sg_NinjaDead,
1730     sg_NinjaDeathJump,
1731     sg_NinjaDeathFall,
1732     {sg_NinjaUzi, sg_NinjaFlashBomb},
1733     {912, 1024},
1734     {sg_NinjaFlashBomb, sg_NinjaUzi, sg_NinjaMirv, sg_NinjaNapalm},
1735     {150, 500, 712, 1024},
1736     {NULL},
1737     sg_NinjaDuck,
1738     sg_NinjaDive
1739     };
1740 
1741 
1742 extern STATEp sg_PlayerNinjaRun[];
1743 extern STATEp sg_PlayerNinjaStand[];
1744 extern STATEp sg_PlayerNinjaJump[];
1745 extern STATEp sg_PlayerNinjaFall[];
1746 extern STATEp sg_PlayerNinjaClimb[];
1747 extern STATEp sg_PlayerNinjaCrawl[];
1748 extern STATEp sg_PlayerNinjaSwim[];
1749 ACTOR_ACTION_SET PlayerNinjaActionSet =
1750     {
1751     sg_PlayerNinjaStand,
1752     sg_PlayerNinjaRun,
1753     sg_PlayerNinjaJump,
1754     sg_PlayerNinjaFall,
1755     //sg_NinjaJump,
1756     //sg_NinjaFall,
1757     sg_PlayerNinjaCrawl,
1758     sg_PlayerNinjaSwim,
1759     sg_NinjaFly,
1760     sg_NinjaRise,
1761     sg_NinjaSit,
1762     NULL,
1763     sg_PlayerNinjaClimb,
1764     sg_NinjaPain,
1765     sg_NinjaDie,
1766     sg_NinjaHariKari,
1767     sg_NinjaDead,
1768     sg_NinjaDeathJump,
1769     sg_NinjaDeathFall,
1770     {sg_NinjaStar, sg_NinjaUzi},
1771     {1000, 1024},
1772     {sg_NinjaStar, sg_NinjaUzi},
1773     {800, 1024},
1774     {NULL},
1775     sg_NinjaDuck,
1776     sg_PlayerNinjaSwim
1777     };
1778 
1779 int
DoHariKariBlood(short SpriteNum)1780 DoHariKariBlood(short SpriteNum)
1781     {
1782     SPRITEp sp = &sprite[SpriteNum];
1783     USERp u = User[SpriteNum];
1784     return(0);
1785     }
1786 
1787 /*
1788 
1789  !AIC - Every actor has a setup where they are initialized
1790 
1791 */
1792 
1793 int
SetupNinja(short SpriteNum)1794 SetupNinja(short SpriteNum)
1795     {
1796     SPRITEp sp = &sprite[SpriteNum];
1797     USERp u;
1798     ANIMATOR DoActorDecide;
1799     short pic = sp->picnum;
1800 
1801     if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE))
1802         {
1803         u = User[SpriteNum];
1804         ASSERT(u);
1805         }
1806     else
1807         {
1808         User[SpriteNum] = u = SpawnUser(SpriteNum, NINJA_RUN_R0, s_NinjaRun[0]);
1809         u->Health = HEALTH_NINJA;
1810         }
1811 
1812     u->StateEnd = s_NinjaDie;
1813     u->Rot = sg_NinjaRun;
1814     sp->xrepeat = 46;
1815     sp->yrepeat = 46;
1816 
1817     if (sp->pal == PALETTE_PLAYER5)
1818         {
1819         u->Attrib = &InvisibleNinjaAttrib;
1820         EnemyDefaults(SpriteNum, &NinjaGreenActionSet, &NinjaPersonality);
1821         if (!TEST(sp->cstat, CSTAT_SPRITE_RESTORE))
1822             u->Health = HEALTH_RED_NINJA;
1823         SET(sp->cstat, CSTAT_SPRITE_TRANSLUCENT);
1824         sp->shade = 127;
1825         sp->pal = u->spal = PALETTE_PLAYER5;
1826         sp->hitag = 9998;
1827         if(pic == NINJA_CRAWL_R0)
1828             {
1829             if (TEST(sp->cstat, CSTAT_SPRITE_YFLIP))
1830                 {
1831                 u->Attrib = &NinjaAttrib;
1832                 u->ActorActionSet = &NinjaActionSet;
1833                 u->Personality = &NinjaPersonality;
1834                 ChangeState(SpriteNum, s_NinjaCeiling[0]);
1835                 }
1836             else
1837                 {
1838                 u->Attrib = &NinjaAttrib;
1839                 u->ActorActionSet = &NinjaSniperActionSet;
1840                 u->Personality = &NinjaSniperPersonality;
1841                 ChangeState(SpriteNum, s_NinjaDuck[0]);
1842                 }
1843             }
1844         }
1845     else
1846     if (sp->pal == PALETTE_PLAYER3)
1847         {
1848         u->Attrib = &NinjaAttrib;
1849         EnemyDefaults(SpriteNum, &NinjaRedActionSet, &NinjaPersonality);
1850         if (!TEST(sp->cstat, CSTAT_SPRITE_RESTORE))
1851             u->Health = HEALTH_RED_NINJA;
1852         sp->pal = u->spal = PALETTE_PLAYER3;
1853         if(pic == NINJA_CRAWL_R0)
1854             {
1855             if (TEST(sp->cstat, CSTAT_SPRITE_YFLIP))
1856                 {
1857                 u->Attrib = &NinjaAttrib;
1858                 u->ActorActionSet = &NinjaActionSet;
1859                 u->Personality = &NinjaPersonality;
1860                 ChangeState(SpriteNum, s_NinjaCeiling[0]);
1861                 }
1862             else
1863                 {
1864                 u->Attrib = &NinjaAttrib;
1865                 u->ActorActionSet = &NinjaSniperActionSet;
1866                 u->Personality = &NinjaSniperPersonality;
1867                 ChangeState(SpriteNum, s_NinjaDuck[0]);
1868                 }
1869             }
1870         }
1871     else
1872     if (sp->pal == PAL_XLAT_LT_TAN)
1873         {
1874         u->Attrib = &NinjaAttrib;
1875         EnemyDefaults(SpriteNum, &NinjaSeekerActionSet, &NinjaPersonality);
1876         if (!TEST(sp->cstat, CSTAT_SPRITE_RESTORE))
1877             u->Health = HEALTH_RED_NINJA;
1878         sp->pal = u->spal = PAL_XLAT_LT_TAN;
1879         u->Attrib = &NinjaAttrib;
1880         }
1881     else
1882     if (sp->pal == PAL_XLAT_LT_GREY)
1883         {
1884         u->Attrib = &NinjaAttrib;
1885         EnemyDefaults(SpriteNum, &NinjaGrenadeActionSet, &NinjaPersonality);
1886         if (!TEST(sp->cstat, CSTAT_SPRITE_RESTORE))
1887             u->Health = HEALTH_RED_NINJA;
1888         sp->pal = u->spal = PAL_XLAT_LT_GREY;
1889         u->Attrib = &NinjaAttrib;
1890         }
1891     else
1892         {
1893         u->Attrib = &NinjaAttrib;
1894         sp->pal = u->spal = PALETTE_PLAYER0;
1895         EnemyDefaults(SpriteNum, &NinjaActionSet, &NinjaPersonality);
1896         if(pic == NINJA_CRAWL_R0)
1897             {
1898             u->Attrib = &NinjaAttrib;
1899             u->ActorActionSet = &NinjaSniperActionSet;
1900             u->Personality = &NinjaSniperPersonality;
1901             ChangeState(SpriteNum, s_NinjaDuck[0]);
1902             }
1903         }
1904 
1905     ChangeState(SpriteNum, s_NinjaRun[0]);
1906     DoActorSetSpeed(SpriteNum, NORM_SPEED);
1907 
1908     u->Radius = 280;
1909     SET(u->Flags, SPR_XFLIP_TOGGLE);
1910 
1911     return (0);
1912     }
1913 
1914 int
DoNinjaHariKari(short SpriteNum)1915 DoNinjaHariKari(short SpriteNum)
1916     {
1917     USERp u = User[SpriteNum];
1918     SPRITEp sp = User[SpriteNum]->SpriteP;
1919     int SpawnBlood(short SpriteNum, short Weapon, short hitang, int hitx, int hity, int hitz);
1920     short cnt,i;
1921 
1922     UpdateSinglePlayKills(SpriteNum);
1923     change_sprite_stat(SpriteNum, STAT_DEAD_ACTOR);
1924     RESET(sprite[SpriteNum].cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN);
1925     SET(u->Flags, SPR_DEAD);
1926     RESET(u->Flags, SPR_FALLING | SPR_JUMPING);
1927     u->floor_dist = Z(40);
1928     u->RotNum = 0;
1929     u->ActorActionFunc = NULL;
1930 
1931     SET(sp->extra, SPRX_BREAKABLE);
1932     SET(sp->cstat, CSTAT_SPRITE_BREAKABLE);
1933 
1934     PlaySound(DIGI_NINJAUZIATTACK,&sp->x,&sp->y,&sp->z,v3df_follow);
1935 
1936     SpawnBlood(SpriteNum, SpriteNum, -1, -1, -1, -1);
1937 
1938     cnt = RANDOM_RANGE(4)+1;
1939     for(i=0; i<=cnt; i++)
1940         InitBloodSpray(SpriteNum,TRUE,-2);
1941 
1942     return(0);
1943     }
1944 
1945 int
DoNinjaGrabThroat(short SpriteNum)1946 DoNinjaGrabThroat(short SpriteNum)
1947     {
1948     USERp u = User[SpriteNum];
1949     SPRITEp sp = User[SpriteNum]->SpriteP;
1950     int SpawnBlood(short SpriteNum, short Weapon, short hitang, int hitx, int hity, int hitz);
1951     short cnt,i;
1952 
1953     if ((u->WaitTics -= ACTORMOVETICS) <= 0)
1954         {
1955         UpdateSinglePlayKills(SpriteNum);
1956         RESET(u->Flags2, SPR2_DYING);
1957         RESET(sp->cstat, CSTAT_SPRITE_YFLIP);
1958         change_sprite_stat(SpriteNum, STAT_DEAD_ACTOR);
1959         RESET(sprite[SpriteNum].cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN);
1960         SET(u->Flags, SPR_DEAD);
1961         RESET(u->Flags, SPR_FALLING | SPR_JUMPING);
1962         u->floor_dist = Z(40);
1963         u->RotNum = 0;
1964         u->ActorActionFunc = NULL;
1965 
1966         SET(sp->extra, SPRX_BREAKABLE);
1967         SET(sp->cstat, CSTAT_SPRITE_BREAKABLE);
1968 
1969         //SpawnBlood(SpriteNum, SpriteNum, -1, -1, -1, -1);
1970 
1971         ChangeState(SpriteNum, u->StateEnd);
1972         sp->xvel = 0;
1973         //u->jump_speed = -300;
1974         //DoActorBeginJump(SpriteNum);
1975         PlaySound(DIGI_NINJASCREAM,&sp->x,&sp->y,&sp->z,v3df_follow);
1976         }
1977 
1978     return(0);
1979     }
1980 
1981 /*
1982 
1983  !AIC - Most actors have one of these and the all look similar
1984 
1985 */
1986 
1987 int
DoNinjaMove(short SpriteNum)1988 DoNinjaMove(short SpriteNum)
1989     {
1990     USERp u = User[SpriteNum];
1991     SPRITEp sp = User[SpriteNum]->SpriteP;
1992 
1993     if (TEST(u->Flags2, SPR2_DYING))
1994         {
1995         NewStateGroup(SpriteNum, sg_NinjaGrabThroat);
1996         return(0);
1997         }
1998 
1999     // jumping and falling
2000     if (TEST(u->Flags, SPR_JUMPING | SPR_FALLING) && !TEST(u->Flags, SPR_CLIMBING))
2001         {
2002         if (TEST(u->Flags, SPR_JUMPING))
2003             DoActorJump(SpriteNum);
2004         else if (TEST(u->Flags, SPR_FALLING))
2005             DoActorFall(SpriteNum);
2006         }
2007 
2008     // sliding
2009     if (TEST(u->Flags, SPR_SLIDING) && !TEST(u->Flags, SPR_CLIMBING))
2010         DoActorSlide(SpriteNum);
2011 
2012     // !AIC - do track or call current action function - such as DoActorMoveCloser()
2013     if (u->track >= 0)
2014         ActorFollowTrack(SpriteNum, ACTORMOVETICS);
2015     else
2016     {
2017         (*u->ActorActionFunc) (SpriteNum);
2018     }
2019 
2020     // stay on floor unless doing certain things
2021     if (!TEST(u->Flags, SPR_JUMPING | SPR_FALLING | SPR_CLIMBING))
2022         {
2023         KeepActorOnFloor(SpriteNum);
2024         }
2025 
2026     // take damage from environment
2027     DoActorSectorDamage(SpriteNum);
2028 
2029     return(0);
2030     }
2031 
2032 int
NinjaJumpActionFunc(short SpriteNum)2033 NinjaJumpActionFunc(short SpriteNum)
2034     {
2035     USERp u = User[SpriteNum];
2036     SPRITEp sp = User[SpriteNum]->SpriteP;
2037     int nx, ny;
2038 
2039     // Move while jumping
2040     nx = sp->xvel * (int) sintable[NORM_ANGLE(sp->ang + 512)] >> 14;
2041     ny = sp->xvel * (int) sintable[sp->ang] >> 14;
2042 
2043     // if cannot move the sprite
2044     if (!move_actor(SpriteNum, nx, ny, 0L))
2045         {
2046         return (0);
2047         }
2048 
2049     if (!TEST(u->Flags, SPR_JUMPING|SPR_FALLING))
2050         {
2051         InitActorDecide(SpriteNum);
2052         }
2053 
2054     return (0);
2055     }
2056 
2057 /*
2058 
2059  !AIC - Short version of DoNinjaMove without the movement code.  For times when
2060  the actor is doing something but not moving.
2061 
2062 */
2063 
2064 int
NullNinja(short SpriteNum)2065 NullNinja(short SpriteNum)
2066     {
2067     USERp u = User[SpriteNum];
2068     SPRITEp sp = User[SpriteNum]->SpriteP;
2069 
2070     if(u->WaitTics > 0) u->WaitTics -= ACTORMOVETICS;
2071 
2072     if (TEST(u->Flags, SPR_SLIDING) && !TEST(u->Flags, SPR_CLIMBING) && !TEST(u->Flags, SPR_JUMPING|SPR_FALLING))
2073         DoActorSlide(SpriteNum);
2074 
2075     if (!TEST(u->Flags, SPR_CLIMBING) && !TEST(u->Flags, SPR_JUMPING|SPR_FALLING))
2076         KeepActorOnFloor(SpriteNum);
2077 
2078     DoActorSectorDamage(SpriteNum);
2079 
2080     return (0);
2081     }
2082 
2083 
DoNinjaPain(short SpriteNum)2084 int DoNinjaPain(short SpriteNum)
2085 {
2086     SPRITEp sp = &sprite[SpriteNum];
2087     USERp u = User[SpriteNum];
2088 
2089     NullNinja(SpriteNum);
2090 
2091     if (TEST(u->Flags2, SPR2_DYING))
2092         {
2093         NewStateGroup(SpriteNum, sg_NinjaGrabThroat);
2094         return(0);
2095         }
2096 
2097     if ((u->WaitTics -= ACTORMOVETICS) <= 0)
2098         InitActorDecide(SpriteNum);
2099 
2100     return(0);
2101 }
2102 
DoNinjaSpecial(short SpriteNum)2103 int DoNinjaSpecial(short SpriteNum)
2104     {
2105     SPRITEp sp = &sprite[SpriteNum];
2106     USERp u = User[SpriteNum];
2107 
2108     if(u->spal == PALETTE_PLAYER5)
2109         {
2110         RESET(sp->cstat,CSTAT_SPRITE_TRANSLUCENT);
2111         sp->hitag = 0;
2112         sp->shade = -10;
2113         }
2114 
2115     return(0);
2116     }
2117 
CheckFire(short SpriteNum)2118 int CheckFire(short SpriteNum)
2119     {
2120     if(!CanSeePlayer(SpriteNum))
2121         InitActorDuck(SpriteNum);
2122     return(0);
2123     }
2124 
2125 int
DoNinjaCeiling(short SpriteNum)2126 DoNinjaCeiling(short SpriteNum)
2127     {
2128     USERp u = User[SpriteNum];
2129     SPRITEp sp = User[SpriteNum]->SpriteP;
2130 
2131     DoActorSectorDamage(SpriteNum);
2132 
2133     return (0);
2134     }
2135 
2136 
2137 //
2138 // !AIC - Stuff from here down is really Player related.  Should be moved but it was
2139 // too convienent to put it here.
2140 //
2141 
2142 VOID
InitAllPlayerSprites(VOID)2143 InitAllPlayerSprites(VOID)
2144     {
2145     short i, sp_num;
2146     USERp u;
2147 
2148     TRAVERSE_CONNECT(i)
2149         {
2150         InitPlayerSprite(Player + i);
2151         }
2152     }
2153 
2154 
2155 VOID
PlayerLevelReset(PLAYERp pp)2156 PlayerLevelReset(PLAYERp pp)
2157     {
2158     SPRITEp sp = &sprite[pp->PlayerSprite];
2159     USERp u = User[pp->PlayerSprite];
2160 
2161     if (gNet.MultiGameType == MULTI_GAME_COMMBAT)
2162         {
2163         PlayerDeathReset(pp);
2164         return;
2165         }
2166 
2167     if (TEST(pp->Flags, PF_DIVING))
2168         DoPlayerStopDiveNoWarp(pp);
2169 
2170     COVER_SetReverb(0); // Turn off any echoing that may have been going before
2171     pp->Reverb = 0;
2172     pp->SecretsFound = 0;
2173     pp->WpnFirstType = WPN_SWORD;
2174     //PlayerUpdateHealth(pp, 500);
2175     //pp->Armor = 0;
2176     //PlayerUpdateArmor(pp, 0);
2177     pp->Kills = 0;
2178     pp->Killer = -1;
2179     pp->NightVision = FALSE;
2180     pp->StartColor = 0;
2181     pp->FadeAmt = 0;
2182     pp->DeathType = 0;
2183     PlayerUpdatePanelInfo(pp);
2184     RESET(sp->cstat, CSTAT_SPRITE_YCENTER);
2185     RESET(sp->cstat, CSTAT_SPRITE_TRANSLUCENT);
2186     RESET(pp->Flags, PF_WEAPON_DOWN|PF_WEAPON_RETRACT);
2187     RESET(pp->Flags, PF_DEAD);
2188 
2189     pp->sop_control = NULL;
2190     pp->sop_riding = NULL;
2191     pp->sop_remote = NULL;
2192     pp->sop = NULL;
2193     DoPlayerResetMovement(pp);
2194     DamageData[u->WeaponNum].Init(pp);
2195     }
2196 
2197 VOID
PlayerDeathReset(PLAYERp pp)2198 PlayerDeathReset(PLAYERp pp)
2199     {
2200     SPRITEp sp = &sprite[pp->PlayerSprite];
2201     USERp u = User[pp->PlayerSprite];
2202 
2203     if (TEST(pp->Flags, PF_DIVING))
2204         DoPlayerStopDiveNoWarp(pp);
2205 
2206     COVER_SetReverb(0); // Turn off any echoing that may have been going before
2207     pp->Reverb = 0;
2208     // second weapon - whatever it is
2209     u->WeaponNum = WPN_SWORD;
2210     pp->WpnFirstType = u->WeaponNum;
2211     pp->WpnRocketType = 0;
2212     pp->WpnRocketHeat = 0;             // 5 to 0 range
2213     pp->WpnRocketNuke = 0;             // 1, you have it, or you don't
2214     pp->WpnFlameType = 0;              // Guardian weapons fire
2215     pp->WpnUziType = 2;
2216     pp->WpnShotgunType = 0;            // Shotgun has normal or fully automatic fire
2217     pp->WpnShotgunAuto = 0;            // 50-0 automatic shotgun rounds
2218     pp->WpnShotgunLastShell = 0;       // Number of last shell fired
2219     pp->Bloody = FALSE;
2220     pp->TestNukeInit = FALSE;
2221     pp->InitingNuke = FALSE;
2222     pp->nukevochandle = 0;
2223     pp->NukeInitialized = FALSE;
2224     pp->BunnyMode = FALSE;
2225 
2226     memset(pp->WpnAmmo,0,sizeof(pp->WpnAmmo));
2227     memset(pp->InventoryTics,0,sizeof(pp->InventoryTics));
2228     memset(pp->InventoryPercent,0,sizeof(pp->InventoryPercent));
2229     memset(pp->InventoryAmount,0,sizeof(pp->InventoryAmount));
2230     memset(pp->InventoryActive,0,sizeof(pp->InventoryActive));
2231     pp->WpnAmmo[WPN_STAR] = 30;
2232     pp->WpnAmmo[WPN_SWORD] = pp->WpnAmmo[WPN_FIST] = 30;
2233     pp->WpnFlags = 0;
2234     pp->WpnGotOnceFlags = 0;
2235     SET(pp->WpnFlags, BIT(WPN_SWORD));
2236     SET(pp->WpnFlags, BIT(WPN_FIST) | BIT(u->WeaponNum));
2237     SET(pp->WpnFlags, BIT(WPN_STAR) | BIT(u->WeaponNum));
2238     RESET(pp->Flags, PF_PICKED_UP_AN_UZI);
2239     RESET(pp->Flags, PF_TWO_UZI);
2240 
2241     u->Health = 100;
2242     pp->MaxHealth = 100;
2243     //PlayerUpdateHealth(pp, 500);
2244     puser[pp->pnum].Health = u->Health;
2245     pp->Armor = 0;
2246     PlayerUpdateArmor(pp, 0);
2247     pp->Killer = -1;
2248     pp->NightVision = FALSE;
2249     pp->StartColor = 0;
2250     pp->FadeAmt = 0;
2251     pp->DeathType = 0;
2252     PlayerUpdatePanelInfo(pp);
2253     RESET(sp->cstat, CSTAT_SPRITE_TRANSLUCENT);
2254     RESET(pp->Flags, PF_WEAPON_DOWN|PF_WEAPON_RETRACT);
2255     RESET(pp->Flags, PF_DEAD);
2256 
2257     pp->sop_control = NULL;
2258     pp->sop_riding = NULL;
2259     pp->sop_remote = NULL;
2260     pp->sop = NULL;
2261     DoPlayerResetMovement(pp);
2262     //if (pp->CurWpn)
2263     //    RESET(pp->CurWpn->flags, PANF_DEATH_HIDE);
2264     DamageData[u->WeaponNum].Init(pp);
2265     }
2266 
2267 VOID
PlayerPanelSetup(VOID)2268 PlayerPanelSetup(VOID)
2269     {
2270     short pnum;
2271     PLAYERp pp;
2272     USERp u;
2273 
2274     // For every player setup the panel weapon stuff
2275     TRAVERSE_CONNECT(pnum)
2276         {
2277         pp = Player + pnum;
2278 
2279         u = User[pp->PlayerSprite];
2280 
2281         ASSERT(u != NULL);
2282 
2283         //u->WeaponNum = WPN_STAR;
2284         //pp->WpnFirstType = WPN_SWORD;
2285 
2286         PlayerUpdateWeapon(pp, u->WeaponNum);
2287         }
2288     }
2289 
2290 VOID
PlayerGameReset(PLAYERp pp)2291 PlayerGameReset(PLAYERp pp)
2292     {
2293     SPRITEp sp = &sprite[pp->PlayerSprite];
2294     USERp u = User[pp->PlayerSprite];
2295 
2296     COVER_SetReverb(0); // Turn off any echoing that may have been going before
2297     pp->Reverb = 0;
2298     u->WeaponNum = WPN_SWORD;
2299     pp->WpnFirstType = u->WeaponNum;
2300     pp->WpnRocketType = 0;
2301     pp->WpnRocketHeat = 0; // 5 to 0 range
2302     pp->WpnRocketNuke = 0; // 1, you have it, or you don't
2303     pp->WpnFlameType = 0; // Guardian weapons fire
2304     pp->WpnUziType = 2;
2305     pp->WpnShotgunType = 0;            // Shotgun has normal or fully automatic fire
2306     pp->WpnShotgunAuto = 0;            // 50-0 automatic shotgun rounds
2307     pp->WpnShotgunLastShell = 0;       // Number of last shell fired
2308     pp->Bloody = FALSE;
2309     pp->TestNukeInit = FALSE;
2310     pp->InitingNuke = FALSE;
2311     pp->nukevochandle = 0;
2312     pp->NukeInitialized = FALSE;
2313     pp->BunnyMode = FALSE;
2314     pp->SecretsFound = 0;
2315 
2316     pp->WpnAmmo[WPN_STAR] = 30;
2317     pp->WpnAmmo[WPN_SWORD] = pp->WpnAmmo[WPN_FIST] = 30;
2318     pp->WpnFlags = 0;
2319     pp->WpnGotOnceFlags = 0;
2320     SET(pp->WpnFlags, BIT(WPN_SWORD));
2321     SET(pp->WpnFlags, BIT(WPN_FIST) | BIT(u->WeaponNum));
2322     SET(pp->WpnFlags, BIT(WPN_STAR) | BIT(u->WeaponNum));
2323     RESET(pp->Flags, PF_PICKED_UP_AN_UZI);
2324     RESET(pp->Flags, PF_TWO_UZI);
2325     pp->MaxHealth = 100;
2326     PlayerUpdateHealth(pp, 500);
2327     pp->Armor = 0;
2328     PlayerUpdateArmor(pp, 0);
2329     pp->Killer = -1;
2330 
2331     if(pp == Player+screenpeek)
2332         {
2333 #if USE_POLYMOST && USE_OPENGL
2334         if (getrendermode() >= 3)
2335             {
2336             setpalettefade(0,0,0,0);
2337             }
2338         else
2339 #endif
2340             {
2341             COVERsetbrightness(gs.Brightness,&palette_data[0][0]);
2342             }
2343         memcpy(pp->temp_pal, palette_data, sizeof(palette_data));
2344         }
2345     pp->NightVision = FALSE;
2346     pp->StartColor = 0;
2347     pp->FadeAmt = 0;
2348     pp->DeathType = 0;
2349 
2350     PlayerUpdatePanelInfo(pp);
2351     RESET(sp->cstat, CSTAT_SPRITE_TRANSLUCENT);
2352 
2353     pp->sop_control = NULL;
2354     pp->sop_riding = NULL;
2355     pp->sop_remote = NULL;
2356     pp->sop = NULL;
2357     DoPlayerResetMovement(pp);
2358     DamageData[u->WeaponNum].Init(pp);
2359     }
2360 
2361 extern ACTOR_ACTION_SET PlayerNinjaActionSet;
2362 
2363 VOID
PlayerSpriteLoadLevel(short SpriteNum)2364 PlayerSpriteLoadLevel(short SpriteNum)
2365     {
2366     USERp u = User[SpriteNum];
2367     SPRITEp sp = User[SpriteNum]->SpriteP;
2368 
2369     ChangeState(SpriteNum, s_NinjaRun[0]);
2370     u->Rot = sg_NinjaRun;
2371     u->ActorActionSet = &PlayerNinjaActionSet;
2372     }
2373 
2374 VOID
InitPlayerSprite(PLAYERp pp)2375 InitPlayerSprite(PLAYERp pp)
2376     {
2377     short i, sp_num;
2378     SPRITE *sp;
2379     USERp u;
2380     int pnum = pp - Player;
2381     extern BOOL NewGame;
2382 
2383     COVER_SetReverb(0); // Turn off any echoing that may have been going before
2384     pp->Reverb = 0;
2385     sp_num = pp->PlayerSprite = SpawnSprite(STAT_PLAYER0 + pnum, NINJA_RUN_R0, NULL, pp->cursectnum, pp->posx,
2386         pp->posy, pp->posz, pp->pang, 0);
2387 
2388     pp->SpriteP = sp = &sprite[sp_num];
2389     pp->pnum = pnum;
2390 
2391     SET(sp->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
2392     SET(sp->extra, SPRX_PLAYER_OR_ENEMY);
2393     RESET(sp->cstat, CSTAT_SPRITE_TRANSLUCENT);
2394 
2395     u = User[sp_num];
2396 
2397     // Grouping items that need to be reset after a LoadLevel
2398     ChangeState(sp_num, s_NinjaRun[0]);
2399     u->Rot = sg_NinjaRun;
2400     u->ActorActionSet = &PlayerNinjaActionSet;
2401 
2402     u->RotNum = 5;
2403 
2404     u->Radius = 400;
2405     u->PlayerP = pp;
2406     //u->Health = pp->MaxHealth;
2407     SET(u->Flags, SPR_XFLIP_TOGGLE);
2408 
2409 
2410     sp->picnum = u->State->Pic;
2411     sp->shade = -60; // was 15
2412     sp->clipdist = (char) (256L >> 2);
2413 
2414     sp->xrepeat = PLAYER_NINJA_XREPEAT;
2415     sp->yrepeat = PLAYER_NINJA_YREPEAT;
2416     sp->pal = PALETTE_PLAYER0 + pp->pnum;
2417     u->spal = sp->pal;
2418 
2419     NewStateGroup(sp_num, u->ActorActionSet->Run);
2420 
2421     pp->PlayerUnderSprite = -1;
2422     pp->UnderSpriteP = NULL;
2423 
2424     DoPlayerZrange(pp);
2425 
2426     if (NewGame)
2427         {
2428         PlayerGameReset(pp);
2429         }
2430     else
2431         {
2432         // save stuff from last level
2433         u->WeaponNum = puser[pnum].WeaponNum;
2434         u->LastWeaponNum = puser[pnum].LastWeaponNum;
2435         u->Health = puser[pnum].Health;
2436         PlayerLevelReset(pp);
2437         }
2438 
2439     memset(pp->InventoryTics,0,sizeof(pp->InventoryTics));
2440 
2441     if(pp == Player+screenpeek)
2442         {
2443 #if USE_POLYMOST && USE_OPENGL
2444         if (getrendermode() >= 3)
2445             {
2446             setpalettefade(0,0,0,0);
2447             }
2448         else
2449 #endif
2450             {
2451             COVERsetbrightness(gs.Brightness,&palette_data[0][0]);
2452             }
2453         memcpy(pp->temp_pal, palette_data, sizeof(palette_data));
2454         }
2455 
2456     pp->NightVision = FALSE;
2457     pp->StartColor = 0;
2458     pp->FadeAmt = 0;
2459     pp->DeathType = 0;
2460     PlayerUpdatePanelInfo(pp);
2461     }
2462 
2463 VOID
SpawnPlayerUnderSprite(PLAYERp pp)2464 SpawnPlayerUnderSprite(PLAYERp pp)
2465     {
2466     USERp pu = User[pp->PlayerSprite], u;
2467     SPRITEp psp = &sprite[pp->PlayerSprite];
2468     SPRITEp sp;
2469     int pnum = pp - Player, sp_num;
2470 
2471     sp_num = pp->PlayerUnderSprite = SpawnSprite(STAT_PLAYER_UNDER0 + pnum,
2472         NINJA_RUN_R0, NULL, pp->cursectnum, pp->posx, pp->posy, pp->posz, pp->pang, 0);
2473 
2474     sp = &sprite[sp_num];
2475     u = User[sp_num];
2476 
2477     pp->UnderSpriteP = sp;
2478 
2479     SET(sp->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
2480     SET(sp->extra, SPRX_PLAYER_OR_ENEMY);
2481 
2482     u->Rot = sg_NinjaRun;
2483     u->RotNum = pu->RotNum;
2484     NewStateGroup(sp_num, pu->Rot);
2485 
2486     u->Radius = pu->Radius;
2487     u->PlayerP = pp;
2488     u->Health = pp->MaxHealth;
2489     SET(u->Flags, SPR_XFLIP_TOGGLE);
2490 
2491     u->ActorActionSet = pu->ActorActionSet;
2492 
2493     sp->picnum = psp->picnum;
2494     sp->clipdist = psp->clipdist;
2495     sp->xrepeat = psp->xrepeat;
2496     sp->yrepeat = psp->yrepeat;
2497 
2498     //sp->pal = psp->pal;
2499     //u->spal = pu->spal;
2500     }
2501 
2502 #include "saveable.h"
2503 
2504 static saveable_code saveable_ninja_code[] = {
2505 	SAVE_CODE(DoHariKariBlood),
2506 	SAVE_CODE(SetupNinja),
2507 	SAVE_CODE(DoNinjaHariKari),
2508 	SAVE_CODE(DoNinjaGrabThroat),
2509 	SAVE_CODE(DoNinjaMove),
2510 	SAVE_CODE(NinjaJumpActionFunc),
2511 	SAVE_CODE(NullNinja),
2512 	SAVE_CODE(DoNinjaPain),
2513 	SAVE_CODE(DoNinjaSpecial),
2514 	SAVE_CODE(CheckFire),
2515 	SAVE_CODE(DoNinjaCeiling)
2516 };
2517 
2518 static saveable_data saveable_ninja_data[] = {
2519 	SAVE_DATA(NinjaBattle),
2520 	SAVE_DATA(NinjaOffense),
2521 	SAVE_DATA(NinjaBroadcast),
2522 	SAVE_DATA(NinjaSurprised),
2523 	SAVE_DATA(NinjaEvasive),
2524 	SAVE_DATA(NinjaLostTarget),
2525 	SAVE_DATA(NinjaCloseRange),
2526 	SAVE_DATA(NinjaSniperRoam),
2527 	SAVE_DATA(NinjaSniperBattle),
2528 
2529 	SAVE_DATA(NinjaPersonality),
2530 	SAVE_DATA(NinjaSniperPersonality),
2531 
2532 	SAVE_DATA(NinjaAttrib),
2533 	SAVE_DATA(InvisibleNinjaAttrib),
2534 	SAVE_DATA(DefaultAttrib),
2535 
2536 	SAVE_DATA(s_NinjaRun),
2537 	SAVE_DATA(sg_NinjaRun),
2538 	SAVE_DATA(s_NinjaStand),
2539 	SAVE_DATA(sg_NinjaStand),
2540 	SAVE_DATA(s_NinjaRise),
2541 	SAVE_DATA(sg_NinjaRise),
2542 	SAVE_DATA(s_NinjaCrawl),
2543 	SAVE_DATA(sg_NinjaCrawl),
2544 	SAVE_DATA(s_NinjaKneelCrawl),
2545 	SAVE_DATA(sg_NinjaKneelCrawl),
2546 	SAVE_DATA(s_NinjaDuck),
2547 	SAVE_DATA(sg_NinjaDuck),
2548 	SAVE_DATA(s_NinjaSit),
2549 	SAVE_DATA(sg_NinjaSit),
2550 	SAVE_DATA(s_NinjaCeiling),
2551 	SAVE_DATA(sg_NinjaCeiling),
2552 	SAVE_DATA(s_NinjaJump),
2553 	SAVE_DATA(sg_NinjaJump),
2554 	SAVE_DATA(s_NinjaFall),
2555 	SAVE_DATA(sg_NinjaFall),
2556 	SAVE_DATA(s_NinjaSwim),
2557 	SAVE_DATA(sg_NinjaSwim),
2558 	SAVE_DATA(s_NinjaDive),
2559 	SAVE_DATA(sg_NinjaDive),
2560 	SAVE_DATA(s_NinjaClimb),
2561 	SAVE_DATA(sg_NinjaClimb),
2562 	SAVE_DATA(s_NinjaFly),
2563 	SAVE_DATA(sg_NinjaFly),
2564 	SAVE_DATA(s_NinjaPain),
2565 	SAVE_DATA(sg_NinjaPain),
2566 	SAVE_DATA(s_NinjaStar),
2567 	SAVE_DATA(sg_NinjaStar),
2568 	SAVE_DATA(s_NinjaMirv),
2569 	SAVE_DATA(sg_NinjaMirv),
2570 	SAVE_DATA(s_NinjaNapalm),
2571 	SAVE_DATA(sg_NinjaNapalm),
2572 	SAVE_DATA(s_NinjaRocket),
2573 	SAVE_DATA(sg_NinjaRocket),
2574 	SAVE_DATA(s_NinjaGrenade),
2575 	SAVE_DATA(sg_NinjaGrenade),
2576 	SAVE_DATA(s_NinjaFlashBomb),
2577 	SAVE_DATA(sg_NinjaFlashBomb),
2578 	SAVE_DATA(s_NinjaUzi),
2579 	SAVE_DATA(sg_NinjaUzi),
2580 	SAVE_DATA(s_NinjaHariKari),
2581 	SAVE_DATA(sg_NinjaHariKari),
2582 	SAVE_DATA(s_NinjaGrabThroat),
2583 	SAVE_DATA(sg_NinjaGrabThroat),
2584 	SAVE_DATA(s_NinjaDie),
2585 	SAVE_DATA(s_NinjaDieSliced),
2586 	SAVE_DATA(s_NinjaDead),
2587 	SAVE_DATA(s_NinjaDeathJump),
2588 	SAVE_DATA(s_NinjaDeathFall),
2589 	SAVE_DATA(sg_NinjaDie),
2590 	SAVE_DATA(sg_NinjaDieSliced),
2591 	SAVE_DATA(sg_NinjaDead),
2592 	SAVE_DATA(sg_NinjaDeathJump),
2593 	SAVE_DATA(sg_NinjaDeathFall),
2594 
2595 	SAVE_DATA(NinjaSniperActionSet),
2596 	SAVE_DATA(NinjaActionSet),
2597 	SAVE_DATA(NinjaRedActionSet),
2598 	SAVE_DATA(NinjaSeekerActionSet),
2599 	SAVE_DATA(NinjaGrenadeActionSet),
2600 	SAVE_DATA(NinjaGreenActionSet),
2601 	SAVE_DATA(PlayerNinjaActionSet),
2602 };
2603 
2604 saveable_module saveable_ninja = {
2605 	// code
2606 	saveable_ninja_code,
2607 	SIZ(saveable_ninja_code),
2608 
2609 	// data
2610 	saveable_ninja_data,
2611 	SIZ(saveable_ninja_data)
2612 };
2613 
2614