summaryrefslogtreecommitdiffstats
path: root/src/jake2/game/monsters/M_Flipper.java
blob: 30235f6a5087dfa0b2b794706d41511ea60af8e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
/*
 * Copyright (C) 1997-2001 Id Software, Inc.
 * 
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation; either version 2 of the License, or (at your option) any later
 * version.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.
 * 
 * See the GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License along with
 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
 * Place - Suite 330, Boston, MA 02111-1307, USA.
 *  
 */

// Created on 13.11.2003 by RST.
// $Id: M_Flipper.java,v 1.4 2005-11-20 22:18:33 salomo Exp $
package jake2.game.monsters;

import jake2.Defines;
import jake2.game.*;
import jake2.game.EntDieAdapter;
import jake2.game.EntInteractAdapter;
import jake2.game.EntPainAdapter;
import jake2.game.EntThinkAdapter;
import jake2.game.GameAI;
import jake2.game.GameBase;
import jake2.game.GameUtil;
import jake2.game.edict_t;
import jake2.game.mframe_t;
import jake2.game.mmove_t;
import jake2.util.Lib;
import jake2.util.Math3D;

public class M_Flipper {

    //	This file generated by ModelGen - Do NOT Modify

    public final static int FRAME_flpbit01 = 0;

    public final static int FRAME_flpbit02 = 1;

    public final static int FRAME_flpbit03 = 2;

    public final static int FRAME_flpbit04 = 3;

    public final static int FRAME_flpbit05 = 4;

    public final static int FRAME_flpbit06 = 5;

    public final static int FRAME_flpbit07 = 6;

    public final static int FRAME_flpbit08 = 7;

    public final static int FRAME_flpbit09 = 8;

    public final static int FRAME_flpbit10 = 9;

    public final static int FRAME_flpbit11 = 10;

    public final static int FRAME_flpbit12 = 11;

    public final static int FRAME_flpbit13 = 12;

    public final static int FRAME_flpbit14 = 13;

    public final static int FRAME_flpbit15 = 14;

    public final static int FRAME_flpbit16 = 15;

    public final static int FRAME_flpbit17 = 16;

    public final static int FRAME_flpbit18 = 17;

    public final static int FRAME_flpbit19 = 18;

    public final static int FRAME_flpbit20 = 19;

    public final static int FRAME_flptal01 = 20;

    public final static int FRAME_flptal02 = 21;

    public final static int FRAME_flptal03 = 22;

    public final static int FRAME_flptal04 = 23;

    public final static int FRAME_flptal05 = 24;

    public final static int FRAME_flptal06 = 25;

    public final static int FRAME_flptal07 = 26;

    public final static int FRAME_flptal08 = 27;

    public final static int FRAME_flptal09 = 28;

    public final static int FRAME_flptal10 = 29;

    public final static int FRAME_flptal11 = 30;

    public final static int FRAME_flptal12 = 31;

    public final static int FRAME_flptal13 = 32;

    public final static int FRAME_flptal14 = 33;

    public final static int FRAME_flptal15 = 34;

    public final static int FRAME_flptal16 = 35;

    public final static int FRAME_flptal17 = 36;

    public final static int FRAME_flptal18 = 37;

    public final static int FRAME_flptal19 = 38;

    public final static int FRAME_flptal20 = 39;

    public final static int FRAME_flptal21 = 40;

    public final static int FRAME_flphor01 = 41;

    public final static int FRAME_flphor02 = 42;

    public final static int FRAME_flphor03 = 43;

    public final static int FRAME_flphor04 = 44;

    public final static int FRAME_flphor05 = 45;

    public final static int FRAME_flphor06 = 46;

    public final static int FRAME_flphor07 = 47;

    public final static int FRAME_flphor08 = 48;

    public final static int FRAME_flphor09 = 49;

    public final static int FRAME_flphor10 = 50;

    public final static int FRAME_flphor11 = 51;

    public final static int FRAME_flphor12 = 52;

    public final static int FRAME_flphor13 = 53;

    public final static int FRAME_flphor14 = 54;

    public final static int FRAME_flphor15 = 55;

    public final static int FRAME_flphor16 = 56;

    public final static int FRAME_flphor17 = 57;

    public final static int FRAME_flphor18 = 58;

    public final static int FRAME_flphor19 = 59;

    public final static int FRAME_flphor20 = 60;

    public final static int FRAME_flphor21 = 61;

    public final static int FRAME_flphor22 = 62;

    public final static int FRAME_flphor23 = 63;

    public final static int FRAME_flphor24 = 64;

    public final static int FRAME_flpver01 = 65;

    public final static int FRAME_flpver02 = 66;

    public final static int FRAME_flpver03 = 67;

    public final static int FRAME_flpver04 = 68;

    public final static int FRAME_flpver05 = 69;

    public final static int FRAME_flpver06 = 70;

    public final static int FRAME_flpver07 = 71;

    public final static int FRAME_flpver08 = 72;

    public final static int FRAME_flpver09 = 73;

    public final static int FRAME_flpver10 = 74;

    public final static int FRAME_flpver11 = 75;

    public final static int FRAME_flpver12 = 76;

    public final static int FRAME_flpver13 = 77;

    public final static int FRAME_flpver14 = 78;

    public final static int FRAME_flpver15 = 79;

    public final static int FRAME_flpver16 = 80;

    public final static int FRAME_flpver17 = 81;

    public final static int FRAME_flpver18 = 82;

    public final static int FRAME_flpver19 = 83;

    public final static int FRAME_flpver20 = 84;

    public final static int FRAME_flpver21 = 85;

    public final static int FRAME_flpver22 = 86;

    public final static int FRAME_flpver23 = 87;

    public final static int FRAME_flpver24 = 88;

    public final static int FRAME_flpver25 = 89;

    public final static int FRAME_flpver26 = 90;

    public final static int FRAME_flpver27 = 91;

    public final static int FRAME_flpver28 = 92;

    public final static int FRAME_flpver29 = 93;

    public final static int FRAME_flppn101 = 94;

    public final static int FRAME_flppn102 = 95;

    public final static int FRAME_flppn103 = 96;

    public final static int FRAME_flppn104 = 97;

    public final static int FRAME_flppn105 = 98;

    public final static int FRAME_flppn201 = 99;

    public final static int FRAME_flppn202 = 100;

    public final static int FRAME_flppn203 = 101;

    public final static int FRAME_flppn204 = 102;

    public final static int FRAME_flppn205 = 103;

    public final static int FRAME_flpdth01 = 104;

    public final static int FRAME_flpdth02 = 105;

    public final static int FRAME_flpdth03 = 106;

    public final static int FRAME_flpdth04 = 107;

    public final static int FRAME_flpdth05 = 108;

    public final static int FRAME_flpdth06 = 109;

    public final static int FRAME_flpdth07 = 110;

    public final static int FRAME_flpdth08 = 111;

    public final static int FRAME_flpdth09 = 112;

    public final static int FRAME_flpdth10 = 113;

    public final static int FRAME_flpdth11 = 114;

    public final static int FRAME_flpdth12 = 115;

    public final static int FRAME_flpdth13 = 116;

    public final static int FRAME_flpdth14 = 117;

    public final static int FRAME_flpdth15 = 118;

    public final static int FRAME_flpdth16 = 119;

    public final static int FRAME_flpdth17 = 120;

    public final static int FRAME_flpdth18 = 121;

    public final static int FRAME_flpdth19 = 122;

    public final static int FRAME_flpdth20 = 123;

    public final static int FRAME_flpdth21 = 124;

    public final static int FRAME_flpdth22 = 125;

    public final static int FRAME_flpdth23 = 126;

    public final static int FRAME_flpdth24 = 127;

    public final static int FRAME_flpdth25 = 128;

    public final static int FRAME_flpdth26 = 129;

    public final static int FRAME_flpdth27 = 130;

    public final static int FRAME_flpdth28 = 131;

    public final static int FRAME_flpdth29 = 132;

    public final static int FRAME_flpdth30 = 133;

    public final static int FRAME_flpdth31 = 134;

    public final static int FRAME_flpdth32 = 135;

    public final static int FRAME_flpdth33 = 136;

    public final static int FRAME_flpdth34 = 137;

    public final static int FRAME_flpdth35 = 138;

    public final static int FRAME_flpdth36 = 139;

    public final static int FRAME_flpdth37 = 140;

    public final static int FRAME_flpdth38 = 141;

    public final static int FRAME_flpdth39 = 142;

    public final static int FRAME_flpdth40 = 143;

    public final static int FRAME_flpdth41 = 144;

    public final static int FRAME_flpdth42 = 145;

    public final static int FRAME_flpdth43 = 146;

    public final static int FRAME_flpdth44 = 147;

    public final static int FRAME_flpdth45 = 148;

    public final static int FRAME_flpdth46 = 149;

    public final static int FRAME_flpdth47 = 150;

    public final static int FRAME_flpdth48 = 151;

    public final static int FRAME_flpdth49 = 152;

    public final static int FRAME_flpdth50 = 153;

    public final static int FRAME_flpdth51 = 154;

    public final static int FRAME_flpdth52 = 155;

    public final static int FRAME_flpdth53 = 156;

    public final static int FRAME_flpdth54 = 157;

    public final static int FRAME_flpdth55 = 158;

    public final static int FRAME_flpdth56 = 159;

    public final static float MODEL_SCALE = 1.000000f;

    static int sound_chomp;

    static int sound_attack;

    static int sound_pain1;

    static int sound_pain2;

    static int sound_death;

    static int sound_idle;

    static int sound_search;

    static int sound_sight;

    static mframe_t flipper_frames_stand[] = new mframe_t[] { new mframe_t(
            GameAI.ai_stand, 0, null) };

    static mmove_t flipper_move_stand = new mmove_t(FRAME_flphor01,
            FRAME_flphor01, flipper_frames_stand, null);

    static EntThinkAdapter flipper_stand = new EntThinkAdapter() {
    	public String getID() { return "flipper_stand"; }
        public boolean think(edict_t self) {
            self.monsterinfo.currentmove = flipper_move_stand;
            return true;
        }
    };

    public final static int FLIPPER_RUN_SPEED = 24;

    static mframe_t flipper_frames_run[] = new mframe_t[] {
            new mframe_t(GameAI.ai_run, FLIPPER_RUN_SPEED, null), // 6
            new mframe_t(GameAI.ai_run, FLIPPER_RUN_SPEED, null),
            new mframe_t(GameAI.ai_run, FLIPPER_RUN_SPEED, null),
            new mframe_t(GameAI.ai_run, FLIPPER_RUN_SPEED, null),
            new mframe_t(GameAI.ai_run, FLIPPER_RUN_SPEED, null),
            // 10

            new mframe_t(GameAI.ai_run, FLIPPER_RUN_SPEED, null),
            new mframe_t(GameAI.ai_run, FLIPPER_RUN_SPEED, null),
            new mframe_t(GameAI.ai_run, FLIPPER_RUN_SPEED, null),
            new mframe_t(GameAI.ai_run, FLIPPER_RUN_SPEED, null),
            new mframe_t(GameAI.ai_run, FLIPPER_RUN_SPEED, null),
            new mframe_t(GameAI.ai_run, FLIPPER_RUN_SPEED, null),
            new mframe_t(GameAI.ai_run, FLIPPER_RUN_SPEED, null),
            new mframe_t(GameAI.ai_run, FLIPPER_RUN_SPEED, null),
            new mframe_t(GameAI.ai_run, FLIPPER_RUN_SPEED, null),
            new mframe_t(GameAI.ai_run, FLIPPER_RUN_SPEED, null),
            // 20

            new mframe_t(GameAI.ai_run, FLIPPER_RUN_SPEED, null),
            new mframe_t(GameAI.ai_run, FLIPPER_RUN_SPEED, null),
            new mframe_t(GameAI.ai_run, FLIPPER_RUN_SPEED, null),
            new mframe_t(GameAI.ai_run, FLIPPER_RUN_SPEED, null),
            new mframe_t(GameAI.ai_run, FLIPPER_RUN_SPEED, null),
            new mframe_t(GameAI.ai_run, FLIPPER_RUN_SPEED, null),
            new mframe_t(GameAI.ai_run, FLIPPER_RUN_SPEED, null),
            new mframe_t(GameAI.ai_run, FLIPPER_RUN_SPEED, null),
            new mframe_t(GameAI.ai_run, FLIPPER_RUN_SPEED, null) // 29
    };

    static mmove_t flipper_move_run_loop = new mmove_t(FRAME_flpver06,
            FRAME_flpver29, flipper_frames_run, null);

    static EntThinkAdapter flipper_run_loop = new EntThinkAdapter() {
    	public String getID() { return "flipper_run_loop"; }
        public boolean think(edict_t self) {
            self.monsterinfo.currentmove = flipper_move_run_loop;
            return true;
        }
    };

    static mframe_t flipper_frames_run_start[] = new mframe_t[] {
            new mframe_t(GameAI.ai_run, 8, null),
            new mframe_t(GameAI.ai_run, 8, null),
            new mframe_t(GameAI.ai_run, 8, null),
            new mframe_t(GameAI.ai_run, 8, null),
            new mframe_t(GameAI.ai_run, 8, null),
            new mframe_t(GameAI.ai_run, 8, null) };

    static mmove_t flipper_move_run_start = new mmove_t(FRAME_flpver01,
            FRAME_flpver06, flipper_frames_run_start, flipper_run_loop);

    static EntThinkAdapter flipper_run = new EntThinkAdapter() {
    	public String getID() { return "flipper_run"; }
        public boolean think(edict_t self) {
            self.monsterinfo.currentmove = flipper_move_run_start;
            return true;
        }
    };

    /* Standard Swimming */
    static mframe_t flipper_frames_walk[] = new mframe_t[] {
            new mframe_t(GameAI.ai_walk, 4, null),
            new mframe_t(GameAI.ai_walk, 4, null),
            new mframe_t(GameAI.ai_walk, 4, null),
            new mframe_t(GameAI.ai_walk, 4, null),
            new mframe_t(GameAI.ai_walk, 4, null),
            new mframe_t(GameAI.ai_walk, 4, null),
            new mframe_t(GameAI.ai_walk, 4, null),
            new mframe_t(GameAI.ai_walk, 4, null),
            new mframe_t(GameAI.ai_walk, 4, null),
            new mframe_t(GameAI.ai_walk, 4, null),
            new mframe_t(GameAI.ai_walk, 4, null),
            new mframe_t(GameAI.ai_walk, 4, null),
            new mframe_t(GameAI.ai_walk, 4, null),
            new mframe_t(GameAI.ai_walk, 4, null),
            new mframe_t(GameAI.ai_walk, 4, null),
            new mframe_t(GameAI.ai_walk, 4, null),
            new mframe_t(GameAI.ai_walk, 4, null),
            new mframe_t(GameAI.ai_walk, 4, null),
            new mframe_t(GameAI.ai_walk, 4, null),
            new mframe_t(GameAI.ai_walk, 4, null),
            new mframe_t(GameAI.ai_walk, 4, null),
            new mframe_t(GameAI.ai_walk, 4, null),
            new mframe_t(GameAI.ai_walk, 4, null),
            new mframe_t(GameAI.ai_walk, 4, null) };

    static mmove_t flipper_move_walk = new mmove_t(FRAME_flphor01,
            FRAME_flphor24, flipper_frames_walk, null);

    static EntThinkAdapter flipper_walk = new EntThinkAdapter() {
    	public String getID() { return "flipper_walk"; }
        public boolean think(edict_t self) {
            self.monsterinfo.currentmove = flipper_move_walk;
            return true;
        }
    };

    static mframe_t flipper_frames_start_run[] = new mframe_t[] {
            new mframe_t(GameAI.ai_run, 8, null),
            new mframe_t(GameAI.ai_run, 8, null),
            new mframe_t(GameAI.ai_run, 8, null),
            new mframe_t(GameAI.ai_run, 8, null),
            new mframe_t(GameAI.ai_run, 8, flipper_run) };

    static mmove_t flipper_move_start_run = new mmove_t(FRAME_flphor01,
            FRAME_flphor05, flipper_frames_start_run, null);

    static EntThinkAdapter flipper_start_run = new EntThinkAdapter() {
    	public String getID() { return "flipper_start_run"; }
        public boolean think(edict_t self) {
            self.monsterinfo.currentmove = flipper_move_start_run;
            return true;
        }
    };

    static mframe_t flipper_frames_pain2[] = new mframe_t[] {
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null) };

    static mmove_t flipper_move_pain2 = new mmove_t(FRAME_flppn101,
            FRAME_flppn105, flipper_frames_pain2, flipper_run);

    static mframe_t flipper_frames_pain1[] = new mframe_t[] {
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null) };

    static mmove_t flipper_move_pain1 = new mmove_t(FRAME_flppn201,
            FRAME_flppn205, flipper_frames_pain1, flipper_run);

    static EntThinkAdapter flipper_bite = new EntThinkAdapter() {
    	public String getID() { return "flipper_bite"; }
        public boolean think(edict_t self) {
            float[] aim = { 0, 0, 0 };

            Math3D.VectorSet(aim, Defines.MELEE_DISTANCE, 0, 0);
            GameWeapon.fire_hit(self, aim, 5, 0);
            return true;
        }
    };

    static EntThinkAdapter flipper_preattack = new EntThinkAdapter() {
    	public String getID() { return "flipper_preattack"; }

        public boolean think(edict_t self) {
            GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_chomp, 1,
                    Defines.ATTN_NORM, 0);
            return true;
        }
    };

    static mframe_t flipper_frames_attack[] = new mframe_t[] {
            new mframe_t(GameAI.ai_charge, 0, flipper_preattack),
            new mframe_t(GameAI.ai_charge, 0, null),
            new mframe_t(GameAI.ai_charge, 0, null),
            new mframe_t(GameAI.ai_charge, 0, null),
            new mframe_t(GameAI.ai_charge, 0, null),
            new mframe_t(GameAI.ai_charge, 0, null),
            new mframe_t(GameAI.ai_charge, 0, null),
            new mframe_t(GameAI.ai_charge, 0, null),
            new mframe_t(GameAI.ai_charge, 0, null),
            new mframe_t(GameAI.ai_charge, 0, null),
            new mframe_t(GameAI.ai_charge, 0, null),
            new mframe_t(GameAI.ai_charge, 0, null),
            new mframe_t(GameAI.ai_charge, 0, null),
            new mframe_t(GameAI.ai_charge, 0, flipper_bite),
            new mframe_t(GameAI.ai_charge, 0, null),
            new mframe_t(GameAI.ai_charge, 0, null),
            new mframe_t(GameAI.ai_charge, 0, null),
            new mframe_t(GameAI.ai_charge, 0, null),
            new mframe_t(GameAI.ai_charge, 0, flipper_bite),
            new mframe_t(GameAI.ai_charge, 0, null) };

    static mmove_t flipper_move_attack = new mmove_t(FRAME_flpbit01,
            FRAME_flpbit20, flipper_frames_attack, flipper_run);

    static EntThinkAdapter flipper_melee = new EntThinkAdapter() {
    	public String getID() { return "flipper_melee"; }
        public boolean think(edict_t self) {
            self.monsterinfo.currentmove = flipper_move_attack;
            return true;
        }
    };

    static EntPainAdapter flipper_pain = new EntPainAdapter() {
    	public String getID() { return "flipper_pain"; }
        public void pain(edict_t self, edict_t other, float kick, int damage) {
            int n;

            if (self.health < (self.max_health / 2))
                self.s.skinnum = 1;

            if (GameBase.level.time < self.pain_debounce_time)
                return;

            self.pain_debounce_time = GameBase.level.time + 3;

            if (GameBase.skill.value == 3)
                return; // no pain anims in nightmare

            n = (Lib.rand() + 1) % 2;
            if (n == 0) {
                GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_pain1, 1,
                        Defines.ATTN_NORM, 0);
                self.monsterinfo.currentmove = flipper_move_pain1;
            } else {
                GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_pain2, 1,
                        Defines.ATTN_NORM, 0);
                self.monsterinfo.currentmove = flipper_move_pain2;
            }
            return;
        }
    };

    static EntThinkAdapter flipper_dead = new EntThinkAdapter() {
    	public String getID() { return "flipper_dead"; }
        public boolean think(edict_t self) {
            Math3D.VectorSet(self.mins, -16, -16, -24);
            Math3D.VectorSet(self.maxs, 16, 16, -8);
            self.movetype = Defines.MOVETYPE_TOSS;
            self.svflags |= Defines.SVF_DEADMONSTER;
            self.nextthink = 0;
            GameBase.gi.linkentity(self);
            return true;
        }
    };

    static mframe_t flipper_frames_death[] = new mframe_t[] {
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null),
            new mframe_t(GameAI.ai_move, 0, null) };

    static mmove_t flipper_move_death = new mmove_t(FRAME_flpdth01,
            FRAME_flpdth56, flipper_frames_death, flipper_dead);

    static EntInteractAdapter flipper_sight = new EntInteractAdapter() {
    	public String getID() { return "flipper_sight"; }
        public boolean interact(edict_t self, edict_t other) {
            GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_sight, 1,
                    Defines.ATTN_NORM, 0);
            return true;
        }
    };

    static EntDieAdapter flipper_die = new EntDieAdapter() {
    	public String getID() { return "flipper_die"; }

        public void die(edict_t self, edict_t inflictor, edict_t attacker,
                int damage, float[] point) {
            int n;

            //	check for gib
            if (self.health <= self.gib_health) {
                GameBase.gi
                        .sound(self, Defines.CHAN_VOICE, GameBase.gi
                                .soundindex("misc/udeath.wav"), 1,
                                Defines.ATTN_NORM, 0);
                for (n = 0; n < 2; n++)
                    GameMisc.ThrowGib(self, "models/objects/gibs/bone/tris.md2",
                            damage, Defines.GIB_ORGANIC);
                for (n = 0; n < 2; n++)
                    GameMisc.ThrowGib(self,
                            "models/objects/gibs/sm_meat/tris.md2", damage,
                            Defines.GIB_ORGANIC);
                GameMisc.ThrowHead(self, "models/objects/gibs/sm_meat/tris.md2",
                        damage, Defines.GIB_ORGANIC);
                self.deadflag = Defines.DEAD_DEAD;
                return;
            }

            if (self.deadflag == Defines.DEAD_DEAD)
                return;

            //	regular death
            GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_death, 1,
                    Defines.ATTN_NORM, 0);
            self.deadflag = Defines.DEAD_DEAD;
            self.takedamage = Defines.DAMAGE_YES;
            self.monsterinfo.currentmove = flipper_move_death;
        }
    };

    /*
     * QUAKED monster_flipper (1 .5 0) (-16 -16 -24) (16 16 32) Ambush
     * Trigger_Spawn Sight
     */
    public static void SP_monster_flipper(edict_t self) {
        if (GameBase.deathmatch.value != 0) {
            GameUtil.G_FreeEdict(self);
            return;
        }

        sound_pain1 = GameBase.gi.soundindex("flipper/flppain1.wav");
        sound_pain2 = GameBase.gi.soundindex("flipper/flppain2.wav");
        sound_death = GameBase.gi.soundindex("flipper/flpdeth1.wav");
        sound_chomp = GameBase.gi.soundindex("flipper/flpatck1.wav");
        sound_attack = GameBase.gi.soundindex("flipper/flpatck2.wav");
        sound_idle = GameBase.gi.soundindex("flipper/flpidle1.wav");
        sound_search = GameBase.gi.soundindex("flipper/flpsrch1.wav");
        sound_sight = GameBase.gi.soundindex("flipper/flpsght1.wav");

        self.movetype = Defines.MOVETYPE_STEP;
        self.solid = Defines.SOLID_BBOX;
        self.s.modelindex = GameBase.gi
                .modelindex("models/monsters/flipper/tris.md2");
        Math3D.VectorSet(self.mins, -16, -16, 0);
        Math3D.VectorSet(self.maxs, 16, 16, 32);

        self.health = 50;
        self.gib_health = -30;
        self.mass = 100;

        self.pain = flipper_pain;
        self.die = flipper_die;

        self.monsterinfo.stand = flipper_stand;
        self.monsterinfo.walk = flipper_walk;
        self.monsterinfo.run = flipper_start_run;
        self.monsterinfo.melee = flipper_melee;
        self.monsterinfo.sight = flipper_sight;

        GameBase.gi.linkentity(self);

        self.monsterinfo.currentmove = flipper_move_stand;
        self.monsterinfo.scale = MODEL_SCALE;

        GameAI.swimmonster_start.think(self);
    }
}