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 "quake.h"
35 #include "actor.h"
36 #include "track.h"
37 #include "fx_man.h"
38 
39 extern BYTE RedBookSong[40];
40 extern short BossSpriteNum[3];
41 
42 ANIMATOR InitZillaCharge;
43 
44 DECISION ZillaBattle[] =
45     {
46     {100,   InitActorRunAway      },
47     {690,   InitActorMoveCloser   },
48     {692,   InitActorAlertNoise   },
49     {1024,  InitActorAttack       }
50     };
51 
52 DECISION ZillaOffense[] =
53     {
54     {100,   InitActorRunAway      },
55     {690,   InitActorMoveCloser   },
56     {692,   InitActorAlertNoise   },
57     {1024,  InitActorAttack       }
58     };
59 
60 DECISION ZillaBroadcast[] =
61     {
62     {2,     InitActorAlertNoise   },
63     {4,     InitActorAmbientNoise  },
64     {1024,  InitActorDecide       }
65     };
66 
67 DECISION ZillaSurprised[] =
68     {
69     {700,   InitActorMoveCloser   },
70     {703,   InitActorAlertNoise   },
71     {1024,  InitActorDecide       }
72     };
73 
74 DECISION ZillaEvasive[] =
75     {
76     {1024, InitActorWanderAround }
77     };
78 
79 DECISION ZillaLostTarget[] =
80     {
81     {900,   InitActorFindPlayer         },
82     {1024,  InitActorWanderAround       }
83     };
84 
85 DECISION ZillaCloseRange[] =
86     {
87     {1024,  InitActorAttack         }
88     };
89 
90 PERSONALITY ZillaPersonality =
91     {
92     ZillaBattle,
93     ZillaOffense,
94     ZillaBroadcast,
95     ZillaSurprised,
96     ZillaEvasive,
97     ZillaLostTarget,
98     ZillaCloseRange,
99     ZillaCloseRange
100     };
101 
102 ATTRIBUTE ZillaAttrib =
103     {
104     {100, 100, 100, 100},                 // Speeds
105     {3, 0, 0, 0},                     // Tic Adjusts
106      3,                               // MaxWeapons;
107     {DIGI_Z17010, DIGI_Z17010, DIGI_Z17025,
108      DIGI_Z17052, DIGI_Z17025, 0,0,0,0,0}
109     };
110 
111 
112 //////////////////////
113 //
114 // ZILLA RUN
115 //
116 //////////////////////
117 
118 #define ZILLA_RATE 48
119 
120 ANIMATOR DoZillaMove,NullZilla,DoStayOnFloor,
121     DoActorDebris, SpawnZillaExp, DoZillaStomp,
122     SpawnCoolg;
123 
124 STATE s_ZillaRun[5][6] =
125     {
126     {
127     {ZILLA_RUN_R0 + 0, ZILLA_RATE, DoZillaMove, &s_ZillaRun[0][1]},
128     {ZILLA_RUN_R0 + 1, SF_QUICK_CALL, DoZillaStomp, &s_ZillaRun[0][2]},
129     {ZILLA_RUN_R0 + 1, ZILLA_RATE, DoZillaMove, &s_ZillaRun[0][3]},
130     {ZILLA_RUN_R0 + 2, ZILLA_RATE, DoZillaMove, &s_ZillaRun[0][4]},
131     {ZILLA_RUN_R0 + 3, SF_QUICK_CALL, DoZillaStomp, &s_ZillaRun[0][5]},
132     {ZILLA_RUN_R0 + 3, ZILLA_RATE, DoZillaMove, &s_ZillaRun[0][0]}
133     },
134     {
135     {ZILLA_RUN_R1 + 0, ZILLA_RATE, DoZillaMove, &s_ZillaRun[1][1]},
136     {ZILLA_RUN_R1 + 1, SF_QUICK_CALL, DoZillaStomp, &s_ZillaRun[1][2]},
137     {ZILLA_RUN_R1 + 1, ZILLA_RATE, DoZillaMove, &s_ZillaRun[1][3]},
138     {ZILLA_RUN_R1 + 2, ZILLA_RATE, DoZillaMove, &s_ZillaRun[1][4]},
139     {ZILLA_RUN_R1 + 3, SF_QUICK_CALL, DoZillaStomp, &s_ZillaRun[1][5]},
140     {ZILLA_RUN_R1 + 3, ZILLA_RATE, DoZillaMove, &s_ZillaRun[1][0]}
141     },
142     {
143     {ZILLA_RUN_R2 + 0, ZILLA_RATE, DoZillaMove, &s_ZillaRun[2][1]},
144     {ZILLA_RUN_R2 + 1, SF_QUICK_CALL, DoZillaStomp, &s_ZillaRun[2][2]},
145     {ZILLA_RUN_R2 + 1, ZILLA_RATE, DoZillaMove, &s_ZillaRun[2][3]},
146     {ZILLA_RUN_R2 + 2, ZILLA_RATE, DoZillaMove, &s_ZillaRun[2][4]},
147     {ZILLA_RUN_R2 + 3, SF_QUICK_CALL, DoZillaStomp, &s_ZillaRun[2][5]},
148     {ZILLA_RUN_R2 + 3, ZILLA_RATE, DoZillaMove, &s_ZillaRun[2][0]}
149     },
150     {
151     {ZILLA_RUN_R3 + 0, ZILLA_RATE, DoZillaMove, &s_ZillaRun[3][1]},
152     {ZILLA_RUN_R3 + 1, SF_QUICK_CALL, DoZillaStomp, &s_ZillaRun[3][2]},
153     {ZILLA_RUN_R3 + 1, ZILLA_RATE, DoZillaMove, &s_ZillaRun[3][3]},
154     {ZILLA_RUN_R3 + 2, ZILLA_RATE, DoZillaMove, &s_ZillaRun[3][4]},
155     {ZILLA_RUN_R3 + 3, SF_QUICK_CALL, DoZillaStomp, &s_ZillaRun[3][5]},
156     {ZILLA_RUN_R3 + 3, ZILLA_RATE, DoZillaMove, &s_ZillaRun[3][0]}
157     },
158     {
159     {ZILLA_RUN_R4 + 0, ZILLA_RATE, DoZillaMove, &s_ZillaRun[4][1]},
160     {ZILLA_RUN_R4 + 1, SF_QUICK_CALL, DoZillaStomp, &s_ZillaRun[4][2]},
161     {ZILLA_RUN_R4 + 1, ZILLA_RATE, DoZillaMove, &s_ZillaRun[4][3]},
162     {ZILLA_RUN_R4 + 2, ZILLA_RATE, DoZillaMove, &s_ZillaRun[4][4]},
163     {ZILLA_RUN_R4 + 3, SF_QUICK_CALL, DoZillaStomp, &s_ZillaRun[4][5]},
164     {ZILLA_RUN_R4 + 3, ZILLA_RATE, DoZillaMove, &s_ZillaRun[4][0]}
165     }
166     };
167 
168 STATEp sg_ZillaRun[] =
169     {
170     &s_ZillaRun[0][0],
171     &s_ZillaRun[1][0],
172     &s_ZillaRun[2][0],
173     &s_ZillaRun[3][0],
174     &s_ZillaRun[4][0]
175     };
176 
177 
178 //////////////////////
179 //
180 // ZILLA STAND
181 //
182 //////////////////////
183 
184 STATE s_ZillaStand[5][1] =
185     {
186     {
187     {ZILLA_RUN_R0 + 0, ZILLA_RATE, DoZillaMove, &s_ZillaStand[0][0]}
188     },
189     {
190     {ZILLA_RUN_R1 + 0, ZILLA_RATE, DoZillaMove, &s_ZillaStand[1][0]}
191     },
192     {
193     {ZILLA_RUN_R2 + 0, ZILLA_RATE, DoZillaMove, &s_ZillaStand[2][0]}
194     },
195     {
196     {ZILLA_RUN_R3 + 0, ZILLA_RATE, DoZillaMove, &s_ZillaStand[3][0]}
197     },
198     {
199     {ZILLA_RUN_R4 + 0, ZILLA_RATE, DoZillaMove, &s_ZillaStand[4][0]}
200     }
201     };
202 
203 STATEp sg_ZillaStand[] =
204     {
205     &s_ZillaStand[0][0],
206     &s_ZillaStand[1][0],
207     &s_ZillaStand[2][0],
208     &s_ZillaStand[3][0],
209     &s_ZillaStand[4][0]
210     };
211 
212 //////////////////////
213 //
214 // ZILLA PAIN
215 //
216 //////////////////////
217 
218 #define ZILLA_PAIN_RATE 30
219 
220 STATE s_ZillaPain[5][2] =
221     {
222     {
223     {ZILLA_PAIN_R0 + 0, ZILLA_PAIN_RATE, NullZilla, &s_ZillaPain[0][1]},
224     {ZILLA_PAIN_R0 + 0, 0|SF_QUICK_CALL, InitActorDecide, &s_ZillaPain[0][0]}
225     },
226     {
227     {ZILLA_PAIN_R1 + 0, ZILLA_PAIN_RATE, NullZilla, &s_ZillaPain[1][1]},
228     {ZILLA_PAIN_R1 + 0, 0|SF_QUICK_CALL, InitActorDecide, &s_ZillaPain[1][0]}
229     },
230     {
231     {ZILLA_PAIN_R2 + 0, ZILLA_PAIN_RATE, NullZilla, &s_ZillaPain[2][1]},
232     {ZILLA_PAIN_R2 + 0, 0|SF_QUICK_CALL, InitActorDecide, &s_ZillaPain[2][0]}
233     },
234     {
235     {ZILLA_PAIN_R3 + 0, ZILLA_PAIN_RATE, NullZilla, &s_ZillaPain[3][1]},
236     {ZILLA_PAIN_R3 + 0, 0|SF_QUICK_CALL, InitActorDecide, &s_ZillaPain[3][0]}
237     },
238     {
239     {ZILLA_PAIN_R4 + 0, ZILLA_PAIN_RATE, NullZilla, &s_ZillaPain[4][1]},
240     {ZILLA_PAIN_R4 + 0, 0|SF_QUICK_CALL, InitActorDecide, &s_ZillaPain[4][0]}
241     }
242     };
243 
244 STATEp sg_ZillaPain[] =
245     {
246     &s_ZillaPain[0][0],
247     &s_ZillaPain[1][0],
248     &s_ZillaPain[2][0],
249     &s_ZillaPain[3][0],
250     &s_ZillaPain[4][0]
251     };
252 
253 //////////////////////
254 //
255 // ZILLA RAIL
256 //
257 //////////////////////
258 
259 #define ZILLA_RAIL_RATE 12
260 ANIMATOR InitZillaRail;
261 
262 STATE s_ZillaRail[5][14] =
263     {
264     {
265     {ZILLA_RAIL_R0 + 0, ZILLA_RAIL_RATE, NullZilla, &s_ZillaRail[0][1]},
266     {ZILLA_RAIL_R0 + 1, ZILLA_RAIL_RATE, NullZilla, &s_ZillaRail[0][2]},
267     {ZILLA_RAIL_R0 + 2, ZILLA_RAIL_RATE, NullZilla, &s_ZillaRail[0][3]},
268     {ZILLA_RAIL_R0 + 3, SF_QUICK_CALL, InitZillaRail, &s_ZillaRail[0][4]},
269     {ZILLA_RAIL_R0 + 0, ZILLA_RAIL_RATE, NullZilla, &s_ZillaRail[0][5]},
270     {ZILLA_RAIL_R0 + 1, ZILLA_RAIL_RATE, NullZilla, &s_ZillaRail[0][6]},
271     {ZILLA_RAIL_R0 + 2, ZILLA_RAIL_RATE, NullZilla, &s_ZillaRail[0][7]},
272     {ZILLA_RAIL_R0 + 3, SF_QUICK_CALL, InitZillaRail, &s_ZillaRail[0][8]},
273     {ZILLA_RAIL_R0 + 0, ZILLA_RAIL_RATE, NullZilla, &s_ZillaRail[0][9]},
274     {ZILLA_RAIL_R0 + 1, ZILLA_RAIL_RATE, NullZilla, &s_ZillaRail[0][10]},
275     {ZILLA_RAIL_R0 + 2, ZILLA_RAIL_RATE, NullZilla, &s_ZillaRail[0][11]},
276     {ZILLA_RAIL_R0 + 3, SF_QUICK_CALL, InitZillaRail, &s_ZillaRail[0][12]},
277     {ZILLA_RAIL_R0 + 3, ZILLA_RAIL_RATE, NullZilla, &s_ZillaRail[0][13]},
278     {ZILLA_RAIL_R0 + 3, SF_QUICK_CALL, InitActorDecide, &s_ZillaRail[0][0]}
279     },
280     {
281     {ZILLA_RAIL_R1 + 0, ZILLA_RAIL_RATE, NullZilla, &s_ZillaRail[1][1]},
282     {ZILLA_RAIL_R1 + 1, ZILLA_RAIL_RATE, NullZilla, &s_ZillaRail[1][2]},
283     {ZILLA_RAIL_R1 + 2, ZILLA_RAIL_RATE, NullZilla, &s_ZillaRail[1][3]},
284     {ZILLA_RAIL_R1 + 3, SF_QUICK_CALL, InitZillaRail, &s_ZillaRail[1][4]},
285     {ZILLA_RAIL_R1 + 0, ZILLA_RAIL_RATE, NullZilla, &s_ZillaRail[1][5]},
286     {ZILLA_RAIL_R1 + 1, ZILLA_RAIL_RATE, NullZilla, &s_ZillaRail[1][6]},
287     {ZILLA_RAIL_R1 + 2, ZILLA_RAIL_RATE, NullZilla, &s_ZillaRail[1][7]},
288     {ZILLA_RAIL_R1 + 3, SF_QUICK_CALL, InitZillaRail, &s_ZillaRail[1][8]},
289     {ZILLA_RAIL_R1 + 0, ZILLA_RAIL_RATE, NullZilla, &s_ZillaRail[1][9]},
290     {ZILLA_RAIL_R1 + 1, ZILLA_RAIL_RATE, NullZilla, &s_ZillaRail[1][10]},
291     {ZILLA_RAIL_R1 + 2, ZILLA_RAIL_RATE, NullZilla, &s_ZillaRail[1][11]},
292     {ZILLA_RAIL_R1 + 3, SF_QUICK_CALL, InitZillaRail, &s_ZillaRail[1][12]},
293     {ZILLA_RAIL_R1 + 3, ZILLA_RAIL_RATE, NullZilla, &s_ZillaRail[1][13]},
294     {ZILLA_RAIL_R1 + 3, SF_QUICK_CALL, InitActorDecide, &s_ZillaRail[1][0]}
295     },
296     {
297     {ZILLA_RAIL_R2 + 0, ZILLA_RAIL_RATE, NullZilla, &s_ZillaRail[2][1]},
298     {ZILLA_RAIL_R2 + 1, ZILLA_RAIL_RATE, NullZilla, &s_ZillaRail[2][2]},
299     {ZILLA_RAIL_R2 + 2, ZILLA_RAIL_RATE, NullZilla, &s_ZillaRail[2][3]},
300     {ZILLA_RAIL_R2 + 3, SF_QUICK_CALL, InitZillaRail, &s_ZillaRail[2][4]},
301     {ZILLA_RAIL_R2 + 0, ZILLA_RAIL_RATE, NullZilla, &s_ZillaRail[2][5]},
302     {ZILLA_RAIL_R2 + 1, ZILLA_RAIL_RATE, NullZilla, &s_ZillaRail[2][6]},
303     {ZILLA_RAIL_R2 + 2, ZILLA_RAIL_RATE, NullZilla, &s_ZillaRail[2][7]},
304     {ZILLA_RAIL_R2 + 3, SF_QUICK_CALL, InitZillaRail, &s_ZillaRail[2][8]},
305     {ZILLA_RAIL_R2 + 0, ZILLA_RAIL_RATE, NullZilla, &s_ZillaRail[2][9]},
306     {ZILLA_RAIL_R2 + 1, ZILLA_RAIL_RATE, NullZilla, &s_ZillaRail[2][10]},
307     {ZILLA_RAIL_R2 + 2, ZILLA_RAIL_RATE, NullZilla, &s_ZillaRail[2][11]},
308     {ZILLA_RAIL_R2 + 3, SF_QUICK_CALL, InitZillaRail, &s_ZillaRail[2][12]},
309     {ZILLA_RAIL_R2 + 3, ZILLA_RAIL_RATE, NullZilla, &s_ZillaRail[2][13]},
310     {ZILLA_RAIL_R2 + 3, SF_QUICK_CALL, InitActorDecide, &s_ZillaRail[2][0]}
311     },
312     {
313     {ZILLA_RAIL_R3 + 0, ZILLA_RAIL_RATE, NullZilla, &s_ZillaRail[3][1]},
314     {ZILLA_RAIL_R3 + 1, ZILLA_RAIL_RATE, NullZilla, &s_ZillaRail[3][2]},
315     {ZILLA_RAIL_R3 + 2, ZILLA_RAIL_RATE, NullZilla, &s_ZillaRail[3][3]},
316     {ZILLA_RAIL_R3 + 3, SF_QUICK_CALL, InitZillaRail, &s_ZillaRail[3][4]},
317     {ZILLA_RAIL_R3 + 0, ZILLA_RAIL_RATE, NullZilla, &s_ZillaRail[3][5]},
318     {ZILLA_RAIL_R3 + 1, ZILLA_RAIL_RATE, NullZilla, &s_ZillaRail[3][6]},
319     {ZILLA_RAIL_R3 + 2, ZILLA_RAIL_RATE, NullZilla, &s_ZillaRail[3][7]},
320     {ZILLA_RAIL_R3 + 3, SF_QUICK_CALL, InitZillaRail, &s_ZillaRail[3][8]},
321     {ZILLA_RAIL_R3 + 0, ZILLA_RAIL_RATE, NullZilla, &s_ZillaRail[3][9]},
322     {ZILLA_RAIL_R3 + 1, ZILLA_RAIL_RATE, NullZilla, &s_ZillaRail[3][10]},
323     {ZILLA_RAIL_R3 + 2, ZILLA_RAIL_RATE, NullZilla, &s_ZillaRail[3][11]},
324     {ZILLA_RAIL_R3 + 3, SF_QUICK_CALL, InitZillaRail, &s_ZillaRail[3][12]},
325     {ZILLA_RAIL_R3 + 3, ZILLA_RAIL_RATE, NullZilla, &s_ZillaRail[3][13]},
326     {ZILLA_RAIL_R3 + 3, SF_QUICK_CALL, InitActorDecide, &s_ZillaRail[3][0]}
327     },
328     {
329     {ZILLA_RAIL_R4 + 0, ZILLA_RAIL_RATE, NullZilla, &s_ZillaRail[4][1]},
330     {ZILLA_RAIL_R4 + 1, ZILLA_RAIL_RATE, NullZilla, &s_ZillaRail[4][2]},
331     {ZILLA_RAIL_R4 + 2, ZILLA_RAIL_RATE, NullZilla, &s_ZillaRail[4][3]},
332     {ZILLA_RAIL_R4 + 3, SF_QUICK_CALL, InitZillaRail, &s_ZillaRail[4][4]},
333     {ZILLA_RAIL_R4 + 0, ZILLA_RAIL_RATE, NullZilla, &s_ZillaRail[4][5]},
334     {ZILLA_RAIL_R4 + 1, ZILLA_RAIL_RATE, NullZilla, &s_ZillaRail[4][6]},
335     {ZILLA_RAIL_R4 + 2, ZILLA_RAIL_RATE, NullZilla, &s_ZillaRail[4][7]},
336     {ZILLA_RAIL_R4 + 3, SF_QUICK_CALL, InitZillaRail, &s_ZillaRail[4][8]},
337     {ZILLA_RAIL_R4 + 0, ZILLA_RAIL_RATE, NullZilla, &s_ZillaRail[4][9]},
338     {ZILLA_RAIL_R4 + 1, ZILLA_RAIL_RATE, NullZilla, &s_ZillaRail[4][10]},
339     {ZILLA_RAIL_R4 + 2, ZILLA_RAIL_RATE, NullZilla, &s_ZillaRail[4][11]},
340     {ZILLA_RAIL_R4 + 3, SF_QUICK_CALL, InitZillaRail, &s_ZillaRail[4][12]},
341     {ZILLA_RAIL_R4 + 3, ZILLA_RAIL_RATE, NullZilla, &s_ZillaRail[4][13]},
342     {ZILLA_RAIL_R4 + 3, SF_QUICK_CALL, InitActorDecide, &s_ZillaRail[4][0]}
343     }
344     };
345 
346 STATEp sg_ZillaRail[] =
347     {
348     &s_ZillaRail[0][0],
349     &s_ZillaRail[1][0],
350     &s_ZillaRail[2][0],
351     &s_ZillaRail[3][0],
352     &s_ZillaRail[4][0]
353     };
354 
355 //////////////////////
356 //
357 // ZILLA ROCKET
358 //
359 //////////////////////
360 
361 #define ZILLA_ROCKET_RATE 12
362 ANIMATOR InitZillaRocket;
363 
364 STATE s_ZillaRocket[5][7] =
365     {
366     {
367     {ZILLA_ROCKET_R0 + 0, ZILLA_ROCKET_RATE, NullZilla, &s_ZillaRocket[0][1]},
368     {ZILLA_ROCKET_R0 + 1, ZILLA_ROCKET_RATE, NullZilla, &s_ZillaRocket[0][2]},
369     {ZILLA_ROCKET_R0 + 2, ZILLA_ROCKET_RATE*4, NullZilla, &s_ZillaRocket[0][3]},
370     {ZILLA_ROCKET_R0 + 2, SF_QUICK_CALL, InitZillaRocket, &s_ZillaRocket[0][4]},
371     {ZILLA_ROCKET_R0 + 2, ZILLA_ROCKET_RATE*4, NullZilla, &s_ZillaRocket[0][5]},
372     {ZILLA_ROCKET_R0 + 3, SF_QUICK_CALL, InitActorDecide, &s_ZillaRocket[0][6]},
373     {ZILLA_ROCKET_R0 + 3, ZILLA_ROCKET_RATE*10, NullZilla, &s_ZillaRocket[0][5]}
374     },
375     {
376     {ZILLA_ROCKET_R1 + 0, ZILLA_ROCKET_RATE, NullZilla, &s_ZillaRocket[1][1]},
377     {ZILLA_ROCKET_R1 + 1, ZILLA_ROCKET_RATE, NullZilla, &s_ZillaRocket[1][2]},
378     {ZILLA_ROCKET_R1 + 2, ZILLA_ROCKET_RATE*4, NullZilla, &s_ZillaRocket[1][3]},
379     {ZILLA_ROCKET_R1 + 2, SF_QUICK_CALL, InitZillaRocket, &s_ZillaRocket[1][4]},
380     {ZILLA_ROCKET_R1 + 2, ZILLA_ROCKET_RATE*4, NullZilla, &s_ZillaRocket[1][5]},
381     {ZILLA_ROCKET_R1 + 3, SF_QUICK_CALL, InitActorDecide, &s_ZillaRocket[1][6]},
382     {ZILLA_ROCKET_R1 + 3, ZILLA_ROCKET_RATE*10, NullZilla, &s_ZillaRocket[1][5]}
383     },
384     {
385     {ZILLA_ROCKET_R2 + 0, ZILLA_ROCKET_RATE, NullZilla, &s_ZillaRocket[2][1]},
386     {ZILLA_ROCKET_R2 + 1, ZILLA_ROCKET_RATE, NullZilla, &s_ZillaRocket[2][2]},
387     {ZILLA_ROCKET_R2 + 2, ZILLA_ROCKET_RATE*4, NullZilla, &s_ZillaRocket[2][3]},
388     {ZILLA_ROCKET_R2 + 2, SF_QUICK_CALL, InitZillaRocket, &s_ZillaRocket[2][4]},
389     {ZILLA_ROCKET_R2 + 2, ZILLA_ROCKET_RATE*4, NullZilla, &s_ZillaRocket[2][5]},
390     {ZILLA_ROCKET_R2 + 3, SF_QUICK_CALL, InitActorDecide, &s_ZillaRocket[2][6]},
391     {ZILLA_ROCKET_R2 + 3, ZILLA_ROCKET_RATE*10, NullZilla, &s_ZillaRocket[2][5]}
392     },
393     {
394     {ZILLA_ROCKET_R3 + 0, ZILLA_ROCKET_RATE, NullZilla, &s_ZillaRocket[3][1]},
395     {ZILLA_ROCKET_R3 + 1, ZILLA_ROCKET_RATE, NullZilla, &s_ZillaRocket[3][2]},
396     {ZILLA_ROCKET_R3 + 2, ZILLA_ROCKET_RATE*4, NullZilla, &s_ZillaRocket[3][3]},
397     {ZILLA_ROCKET_R3 + 2, SF_QUICK_CALL, InitZillaRocket, &s_ZillaRocket[3][4]},
398     {ZILLA_ROCKET_R3 + 2, ZILLA_ROCKET_RATE*4, NullZilla, &s_ZillaRocket[3][5]},
399     {ZILLA_ROCKET_R3 + 3, SF_QUICK_CALL, InitActorDecide, &s_ZillaRocket[3][6]},
400     {ZILLA_ROCKET_R3 + 3, ZILLA_ROCKET_RATE*10, NullZilla, &s_ZillaRocket[3][5]}
401     },
402     {
403     {ZILLA_ROCKET_R4 + 0, ZILLA_ROCKET_RATE, NullZilla, &s_ZillaRocket[4][1]},
404     {ZILLA_ROCKET_R4 + 1, ZILLA_ROCKET_RATE, NullZilla, &s_ZillaRocket[4][2]},
405     {ZILLA_ROCKET_R4 + 2, ZILLA_ROCKET_RATE*4, NullZilla, &s_ZillaRocket[4][3]},
406     {ZILLA_ROCKET_R4 + 2, SF_QUICK_CALL, InitZillaRocket, &s_ZillaRocket[4][4]},
407     {ZILLA_ROCKET_R4 + 2, ZILLA_ROCKET_RATE*4, NullZilla, &s_ZillaRocket[4][5]},
408     {ZILLA_ROCKET_R4 + 3, SF_QUICK_CALL, InitActorDecide, &s_ZillaRocket[4][6]},
409     {ZILLA_ROCKET_R4 + 3, ZILLA_ROCKET_RATE*10, NullZilla, &s_ZillaRocket[4][5]}
410     }
411     };
412 
413 STATEp sg_ZillaRocket[] =
414     {
415     &s_ZillaRocket[0][0],
416     &s_ZillaRocket[1][0],
417     &s_ZillaRocket[2][0],
418     &s_ZillaRocket[3][0],
419     &s_ZillaRocket[4][0]
420     };
421 
422 //////////////////////
423 //
424 // ZILLA UZI
425 //
426 //////////////////////
427 
428 #define ZILLA_UZI_RATE 8
429 ANIMATOR InitEnemyUzi;
430 
431 STATE s_ZillaUzi[5][17] =
432     {
433     {
434     {ZILLA_SHOOT_R0 + 0, ZILLA_UZI_RATE, NullZilla, &s_ZillaUzi[0][1]},
435     {ZILLA_SHOOT_R0 + 0, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_ZillaUzi[0][2]},
436     {ZILLA_SHOOT_R0 + 0, ZILLA_UZI_RATE, NullZilla, &s_ZillaUzi[0][3]},
437     {ZILLA_SHOOT_R0 + 0, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_ZillaUzi[0][4]},
438     {ZILLA_SHOOT_R0 + 0, ZILLA_UZI_RATE, NullZilla, &s_ZillaUzi[0][5]},
439     {ZILLA_SHOOT_R0 + 0, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_ZillaUzi[0][6]},
440     {ZILLA_SHOOT_R0 + 0, ZILLA_UZI_RATE, NullZilla, &s_ZillaUzi[0][7]},
441     {ZILLA_SHOOT_R0 + 0, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_ZillaUzi[0][8]},
442     {ZILLA_SHOOT_R0 + 0, ZILLA_UZI_RATE, NullZilla, &s_ZillaUzi[0][9]},
443     {ZILLA_SHOOT_R0 + 0, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_ZillaUzi[0][10]},
444     {ZILLA_SHOOT_R0 + 0, ZILLA_UZI_RATE, NullZilla, &s_ZillaUzi[0][11]},
445     {ZILLA_SHOOT_R0 + 0, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_ZillaUzi[0][12]},
446     {ZILLA_SHOOT_R0 + 0, ZILLA_UZI_RATE, NullZilla, &s_ZillaUzi[0][13]},
447     {ZILLA_SHOOT_R0 + 0, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_ZillaUzi[0][14]},
448     {ZILLA_SHOOT_R0 + 0, ZILLA_UZI_RATE, NullZilla, &s_ZillaUzi[0][15]},
449     {ZILLA_SHOOT_R0 + 0, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_ZillaUzi[0][16]},
450     {ZILLA_SHOOT_R0 + 0, 0 | SF_QUICK_CALL, InitActorDecide, &s_ZillaUzi[0][16]},
451     },
452     {
453     {ZILLA_SHOOT_R1 + 0, ZILLA_UZI_RATE, NullZilla, &s_ZillaUzi[1][1]},
454     {ZILLA_SHOOT_R1 + 0, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_ZillaUzi[1][2]},
455     {ZILLA_SHOOT_R1 + 0, ZILLA_UZI_RATE, NullZilla, &s_ZillaUzi[1][3]},
456     {ZILLA_SHOOT_R1 + 0, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_ZillaUzi[1][4]},
457     {ZILLA_SHOOT_R1 + 0, ZILLA_UZI_RATE, NullZilla, &s_ZillaUzi[1][5]},
458     {ZILLA_SHOOT_R1 + 0, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_ZillaUzi[1][6]},
459     {ZILLA_SHOOT_R1 + 0, ZILLA_UZI_RATE, NullZilla, &s_ZillaUzi[1][7]},
460     {ZILLA_SHOOT_R1 + 0, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_ZillaUzi[1][8]},
461     {ZILLA_SHOOT_R1 + 0, ZILLA_UZI_RATE, NullZilla, &s_ZillaUzi[1][9]},
462     {ZILLA_SHOOT_R1 + 0, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_ZillaUzi[1][10]},
463     {ZILLA_SHOOT_R1 + 0, ZILLA_UZI_RATE, NullZilla, &s_ZillaUzi[1][11]},
464     {ZILLA_SHOOT_R1 + 0, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_ZillaUzi[1][12]},
465     {ZILLA_SHOOT_R1 + 0, ZILLA_UZI_RATE, NullZilla, &s_ZillaUzi[1][13]},
466     {ZILLA_SHOOT_R1 + 0, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_ZillaUzi[1][14]},
467     {ZILLA_SHOOT_R1 + 0, ZILLA_UZI_RATE, NullZilla, &s_ZillaUzi[1][15]},
468     {ZILLA_SHOOT_R1 + 0, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_ZillaUzi[1][16]},
469     {ZILLA_SHOOT_R1 + 0, 0 | SF_QUICK_CALL, InitActorDecide, &s_ZillaUzi[1][16]},
470     },
471     {
472     {ZILLA_SHOOT_R2 + 0, ZILLA_UZI_RATE, NullZilla, &s_ZillaUzi[2][1]},
473     {ZILLA_SHOOT_R2 + 0, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_ZillaUzi[2][2]},
474     {ZILLA_SHOOT_R2 + 0, ZILLA_UZI_RATE, NullZilla, &s_ZillaUzi[2][3]},
475     {ZILLA_SHOOT_R2 + 0, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_ZillaUzi[2][4]},
476     {ZILLA_SHOOT_R2 + 0, ZILLA_UZI_RATE, NullZilla, &s_ZillaUzi[2][5]},
477     {ZILLA_SHOOT_R2 + 0, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_ZillaUzi[2][6]},
478     {ZILLA_SHOOT_R2 + 0, ZILLA_UZI_RATE, NullZilla, &s_ZillaUzi[2][7]},
479     {ZILLA_SHOOT_R2 + 0, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_ZillaUzi[2][8]},
480     {ZILLA_SHOOT_R2 + 0, ZILLA_UZI_RATE, NullZilla, &s_ZillaUzi[2][9]},
481     {ZILLA_SHOOT_R2 + 0, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_ZillaUzi[2][10]},
482     {ZILLA_SHOOT_R2 + 0, ZILLA_UZI_RATE, NullZilla, &s_ZillaUzi[2][11]},
483     {ZILLA_SHOOT_R2 + 0, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_ZillaUzi[2][12]},
484     {ZILLA_SHOOT_R2 + 0, ZILLA_UZI_RATE, NullZilla, &s_ZillaUzi[2][13]},
485     {ZILLA_SHOOT_R2 + 0, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_ZillaUzi[2][14]},
486     {ZILLA_SHOOT_R2 + 0, ZILLA_UZI_RATE, NullZilla, &s_ZillaUzi[2][15]},
487     {ZILLA_SHOOT_R2 + 0, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_ZillaUzi[2][16]},
488     {ZILLA_SHOOT_R2 + 0, 0 | SF_QUICK_CALL, InitActorDecide, &s_ZillaUzi[2][16]},
489     },
490     {
491     {ZILLA_SHOOT_R3 + 0, ZILLA_UZI_RATE, NullZilla, &s_ZillaUzi[3][1]},
492     {ZILLA_SHOOT_R3 + 0, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_ZillaUzi[3][2]},
493     {ZILLA_SHOOT_R3 + 0, ZILLA_UZI_RATE, NullZilla, &s_ZillaUzi[3][3]},
494     {ZILLA_SHOOT_R3 + 0, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_ZillaUzi[3][4]},
495     {ZILLA_SHOOT_R3 + 0, ZILLA_UZI_RATE, NullZilla, &s_ZillaUzi[3][5]},
496     {ZILLA_SHOOT_R3 + 0, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_ZillaUzi[3][6]},
497     {ZILLA_SHOOT_R3 + 0, ZILLA_UZI_RATE, NullZilla, &s_ZillaUzi[3][7]},
498     {ZILLA_SHOOT_R3 + 0, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_ZillaUzi[3][8]},
499     {ZILLA_SHOOT_R3 + 0, ZILLA_UZI_RATE, NullZilla, &s_ZillaUzi[3][9]},
500     {ZILLA_SHOOT_R3 + 0, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_ZillaUzi[3][10]},
501     {ZILLA_SHOOT_R3 + 0, ZILLA_UZI_RATE, NullZilla, &s_ZillaUzi[3][11]},
502     {ZILLA_SHOOT_R3 + 0, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_ZillaUzi[3][12]},
503     {ZILLA_SHOOT_R3 + 0, ZILLA_UZI_RATE, NullZilla, &s_ZillaUzi[3][13]},
504     {ZILLA_SHOOT_R3 + 0, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_ZillaUzi[3][14]},
505     {ZILLA_SHOOT_R3 + 0, ZILLA_UZI_RATE, NullZilla, &s_ZillaUzi[3][15]},
506     {ZILLA_SHOOT_R3 + 0, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_ZillaUzi[3][16]},
507     {ZILLA_SHOOT_R3 + 0, 0 | SF_QUICK_CALL, InitActorDecide, &s_ZillaUzi[3][16]},
508     },
509     {
510     {ZILLA_SHOOT_R4 + 0, ZILLA_UZI_RATE, NullZilla, &s_ZillaUzi[4][1]},
511     {ZILLA_SHOOT_R4 + 0, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_ZillaUzi[4][2]},
512     {ZILLA_SHOOT_R4 + 0, ZILLA_UZI_RATE, NullZilla, &s_ZillaUzi[4][3]},
513     {ZILLA_SHOOT_R4 + 0, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_ZillaUzi[4][4]},
514     {ZILLA_SHOOT_R4 + 0, ZILLA_UZI_RATE, NullZilla, &s_ZillaUzi[4][5]},
515     {ZILLA_SHOOT_R4 + 0, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_ZillaUzi[4][6]},
516     {ZILLA_SHOOT_R4 + 0, ZILLA_UZI_RATE, NullZilla, &s_ZillaUzi[4][7]},
517     {ZILLA_SHOOT_R4 + 0, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_ZillaUzi[4][8]},
518     {ZILLA_SHOOT_R4 + 0, ZILLA_UZI_RATE, NullZilla, &s_ZillaUzi[4][9]},
519     {ZILLA_SHOOT_R4 + 0, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_ZillaUzi[4][10]},
520     {ZILLA_SHOOT_R4 + 0, ZILLA_UZI_RATE, NullZilla, &s_ZillaUzi[4][11]},
521     {ZILLA_SHOOT_R4 + 0, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_ZillaUzi[4][12]},
522     {ZILLA_SHOOT_R4 + 0, ZILLA_UZI_RATE, NullZilla, &s_ZillaUzi[4][13]},
523     {ZILLA_SHOOT_R4 + 0, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_ZillaUzi[4][14]},
524     {ZILLA_SHOOT_R4 + 0, ZILLA_UZI_RATE, NullZilla, &s_ZillaUzi[4][15]},
525     {ZILLA_SHOOT_R4 + 0, 0 | SF_QUICK_CALL, InitEnemyUzi, &s_ZillaUzi[4][16]},
526     {ZILLA_SHOOT_R4 + 0, 0 | SF_QUICK_CALL, InitActorDecide, &s_ZillaUzi[4][16]},
527     },
528     };
529 
530 
531 STATEp sg_ZillaUzi[] =
532     {
533     s_ZillaUzi[0],
534     s_ZillaUzi[1],
535     s_ZillaUzi[2],
536     s_ZillaUzi[3],
537     s_ZillaUzi[4]
538     };
539 
540 
541 //////////////////////
542 //
543 // ZILLA DIE
544 //
545 //////////////////////
546 
547 #define ZILLA_DIE_RATE 30
548 ANIMATOR DoZillaDeathMelt;
549 
550 STATE s_ZillaDie[] =
551     {
552     {ZILLA_DIE + 0, ZILLA_DIE_RATE*15, DoZillaDeathMelt, &s_ZillaDie[1]},
553     {ZILLA_DIE + 1, ZILLA_DIE_RATE, NullZilla, &s_ZillaDie[2]},
554     {ZILLA_DIE + 2, ZILLA_DIE_RATE, NullZilla, &s_ZillaDie[3]},
555     {ZILLA_DIE + 3, ZILLA_DIE_RATE, NullZilla, &s_ZillaDie[4]},
556     {ZILLA_DIE + 4, ZILLA_DIE_RATE, NullZilla, &s_ZillaDie[5]},
557     {ZILLA_DIE + 5, ZILLA_DIE_RATE, NullZilla, &s_ZillaDie[6]},
558     {ZILLA_DIE + 6, ZILLA_DIE_RATE, NullZilla, &s_ZillaDie[7]},
559     {ZILLA_DIE + 7, ZILLA_DIE_RATE*3, NullZilla, &s_ZillaDie[8]},
560     {ZILLA_DEAD, ZILLA_DIE_RATE, DoActorDebris, &s_ZillaDie[8]}
561     };
562 
563 STATEp sg_ZillaDie[] =
564     {
565     s_ZillaDie
566     };
567 
568 STATE s_ZillaDead[] =
569     {
570     {ZILLA_DEAD, ZILLA_DIE_RATE, DoActorDebris, &s_ZillaDead[0]},
571     };
572 
573 STATEp sg_ZillaDead[] =
574     {
575     s_ZillaDead
576     };
577 
578 /*
579 typedef struct
580 {
581 #define MAX_ACTOR_CLOSE_ATTACK 2
582 #define MAX_ACTOR_ATTACK 6
583 STATEp *Stand;
584 STATEp *Run;
585 STATEp *Jump;
586 STATEp *Fall;
587 STATEp *Crawl;
588 STATEp *Swim;
589 STATEp *Fly;
590 STATEp *Rise;
591 STATEp *Sit;
592 STATEp *Look;
593 STATEp *Climb;
594 STATEp *Pain;
595 STATEp *Death1;
596 STATEp *Death2;
597 STATEp *Dead;
598 STATEp *DeathJump;
599 STATEp *DeathFall;
600 
601 STATEp *CloseAttack[MAX_ACTOR_CLOSE_ATTACK];
602 short  CloseAttackPercent[MAX_ACTOR_CLOSE_ATTACK];
603 
604 STATEp *Attack[MAX_ACTOR_ATTACK];
605 short  AttackPercent[MAX_ACTOR_ATTACK];
606 
607 STATEp *Special[2];
608 STATEp *Duck;
609 STATEp *Dive;
610 }ACTOR_ACTION_SET,*ACTOR_ACTION_SETp;
611 */
612 
613 ACTOR_ACTION_SET ZillaActionSet =
614   {
615   sg_ZillaStand,
616   sg_ZillaRun,
617   NULL,
618   NULL,
619   NULL,
620   NULL,
621   NULL,
622   NULL,
623   NULL,
624   NULL,
625   NULL,//climb
626   sg_ZillaPain,//pain
627   sg_ZillaDie,
628   NULL,
629   sg_ZillaDead,
630   NULL,
631   NULL,
632   {sg_ZillaUzi,sg_ZillaRail},
633   {950,1024},
634   {sg_ZillaUzi,sg_ZillaRocket,sg_ZillaRail},
635   {400,950,1024},
636   {NULL},
637   NULL,
638   NULL
639   };
640 
641 int
SetupZilla(short SpriteNum)642 SetupZilla(short SpriteNum)
643 {
644     SPRITEp sp = &sprite[SpriteNum];
645     USERp u;
646     ANIMATOR DoActorDecide;
647 
648     if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE))
649         {
650         u = User[SpriteNum];
651         ASSERT(u);
652         }
653     else
654         {
655         User[SpriteNum] = u = SpawnUser(SpriteNum,ZILLA_RUN_R0,s_ZillaRun[0]);
656         u->Health = 6000;
657         }
658 
659     if (Skill == 0) u->Health = 2000;
660     if (Skill == 1) u->Health = 4000;
661 
662     ChangeState(SpriteNum,s_ZillaRun[0]);
663     u->Attrib = &ZillaAttrib;
664     DoActorSetSpeed(SpriteNum, NORM_SPEED);
665     u->StateEnd = s_ZillaDie;
666     u->Rot = sg_ZillaRun;
667 
668     EnemyDefaults(SpriteNum, &ZillaActionSet, &ZillaPersonality);
669 
670     sp->clipdist = (512) >> 2;
671     sp->xrepeat = 97;
672     sp->yrepeat = 79;
673 
674     //SET(u->Flags, SPR_XFLIP_TOGGLE);
675 
676     return(0);
677 }
678 
NullZilla(short SpriteNum)679 int NullZilla(short SpriteNum)
680 {
681     USERp u = User[SpriteNum];
682     SPRITEp sp = User[SpriteNum]->SpriteP;
683 
684     //if (TEST(u->Flags,SPR_SLIDING))
685         //DoActorSlide(SpriteNum);
686 
687     #if 0
688     if (u->State == s_ZillaDie)
689         {
690         getzsofslope(sp->sectnum, sp->x, sp->y, &u->hiz, &u->loz);
691         u->lo_sectp = &sector[sp->sectnum];
692         u->hi_sectp = &sector[sp->sectnum];
693         sp->z = u->loz;
694         }
695     #endif
696 
697     //if (!TEST(u->Flags,SPR_CLIMBING))
698     //    KeepActorOnFloor(SpriteNum);
699     getzsofslope(sp->sectnum, sp->x, sp->y, &u->hiz, &u->loz);
700     u->lo_sectp = &sector[sp->sectnum];
701     u->hi_sectp = &sector[sp->sectnum];
702     u->lo_sp = NULL;
703     u->hi_sp = NULL;
704     sp->z = u->loz;
705 
706     DoActorSectorDamage(SpriteNum);
707 
708     return(0);
709 }
710 
DoZillaMove(short SpriteNum)711 int DoZillaMove(short SpriteNum)
712 {
713     SPRITEp sp = &sprite[SpriteNum];
714     USERp u = User[SpriteNum];
715     short choose;
716     static int handle;
717 
718     //if (TEST(u->Flags,SPR_SLIDING))
719        //DoActorSlide(SpriteNum);
720 
721     // Random Zilla taunts
722     if (!FX_SoundActive(handle))
723         {
724         choose = STD_RANDOM_RANGE(1000);
725         if (choose > 990)
726             handle = PlaySound(DIGI_Z16004,&sp->x,&sp->y,&sp->z,v3df_none);
727         else
728         if (choose > 985)
729             handle = PlaySound(DIGI_Z16004,&sp->x,&sp->y,&sp->z,v3df_none);
730         else
731         if (choose > 980)
732             handle = PlaySound(DIGI_Z16004,&sp->x,&sp->y,&sp->z,v3df_none);
733         else
734         if (choose > 975)
735             handle = PlaySound(DIGI_Z16004,&sp->x,&sp->y,&sp->z,v3df_none);
736         }
737 
738 
739     if (u->track >= 0)
740         ActorFollowTrack(SpriteNum, ACTORMOVETICS);
741     else
742         (*u->ActorActionFunc)(SpriteNum);
743 
744     KeepActorOnFloor(SpriteNum);
745 
746     if (DoActorSectorDamage(SpriteNum))
747         {
748         return(0);
749         }
750 
751     return(0);
752 }
753 
DoZillaStomp(short SpriteNum)754 int DoZillaStomp(short SpriteNum)
755     {
756     SPRITEp sp = &sprite[SpriteNum];
757 
758     PlaySound(DIGI_ZILLASTOMP,&sp->x,&sp->y,&sp->z,v3df_follow);
759 
760     return 0;
761     }
762 
763 extern int SpawnGrenadeExp(SHORT Weapon);
764 
DoZillaDeathMelt(short SpriteNum)765 int DoZillaDeathMelt(short SpriteNum)
766 {
767     SPRITEp sp = &sprite[SpriteNum];
768     USERp u = User[SpriteNum];
769     static BOOL alreadydid = FALSE;
770 
771     if (RANDOM_RANGE(1000) > 800)
772         SpawnGrenadeExp(SpriteNum);
773 
774     u->ID = ZILLA_RUN_R0;
775     RESET(u->Flags, SPR_JUMPING|SPR_FALLING|SPR_MOVED);
776 
777     //DoMatchEverything(NULL, sp->lotag, ON);
778     if (!SW_SHAREWARE && gs.MusicOn && !alreadydid)
779         {
780         PlaySong(0, RedBookSong[Level], TRUE, TRUE);
781         alreadydid = TRUE;
782         }
783 
784     //KeepActorOnFloor(SpriteNum);
785     getzsofslope(sp->sectnum, sp->x, sp->y, &u->hiz, &u->loz);
786     u->lo_sectp = &sector[sp->sectnum];
787     u->hi_sectp = &sector[sp->sectnum];
788     u->lo_sp = NULL;
789     u->hi_sp = NULL;
790     sp->z = u->loz;
791 
792     BossSpriteNum[2] = -2;
793     return(0);
794 }
795 
796 
797 #include "saveable.h"
798 
799 static saveable_code saveable_zilla_code[] = {
800 	SAVE_CODE(SetupZilla),
801 	SAVE_CODE(NullZilla),
802 	SAVE_CODE(DoZillaMove),
803 	SAVE_CODE(DoZillaStomp),
804 	SAVE_CODE(DoZillaDeathMelt),
805 };
806 
807 static saveable_data saveable_zilla_data[] = {
808 	SAVE_DATA(ZillaBattle),
809 	SAVE_DATA(ZillaOffense),
810 	SAVE_DATA(ZillaBroadcast),
811 	SAVE_DATA(ZillaSurprised),
812 	SAVE_DATA(ZillaEvasive),
813 	SAVE_DATA(ZillaLostTarget),
814 	SAVE_DATA(ZillaCloseRange),
815 
816 	SAVE_DATA(ZillaPersonality),
817 
818 	SAVE_DATA(ZillaAttrib),
819 
820 	SAVE_DATA(s_ZillaRun),
821 	SAVE_DATA(sg_ZillaRun),
822 	SAVE_DATA(s_ZillaStand),
823 	SAVE_DATA(sg_ZillaStand),
824 	SAVE_DATA(s_ZillaPain),
825 	SAVE_DATA(sg_ZillaPain),
826 	SAVE_DATA(s_ZillaRail),
827 	SAVE_DATA(sg_ZillaRail),
828 	SAVE_DATA(s_ZillaRocket),
829 	SAVE_DATA(sg_ZillaRocket),
830 	SAVE_DATA(s_ZillaUzi),
831 	SAVE_DATA(sg_ZillaUzi),
832 	SAVE_DATA(s_ZillaDie),
833 	SAVE_DATA(sg_ZillaDie),
834 	SAVE_DATA(s_ZillaDead),
835 	SAVE_DATA(sg_ZillaDead),
836 
837 	SAVE_DATA(ZillaActionSet),
838 };
839 
840 saveable_module saveable_zilla = {
841 	// code
842 	saveable_zilla_code,
843 	SIZ(saveable_zilla_code),
844 
845 	// data
846 	saveable_zilla_data,
847 	SIZ(saveable_zilla_data)
848 };
849 
850