home *** CD-ROM | disk | FTP | other *** search
/ Gambler 19 / GAMBLERCD19.BIN / UTILS / 3D / BRONIE / DUAL_LAU.ZIP / src / m_supertank.c < prev    next >
C/C++ Source or Header  |  1998-01-13  |  16KB  |  699 lines

  1. /*
  2. ==============================================================================
  3.  
  4. SUPERTANK
  5.  
  6. ==============================================================================
  7. */
  8.  
  9. #include "g_local.h"
  10. #include "m_supertank.h"
  11.  
  12. qboolean visible (edict_t *self, edict_t *other);
  13.  
  14. static int    sound_pain1;
  15. static int    sound_pain2;
  16. static int    sound_pain3;
  17. static int    sound_death;
  18. static int    sound_search1;
  19. static int    sound_search2;
  20.  
  21. static    int    tread_sound;
  22.  
  23. void BossExplode (edict_t *self);
  24.  
  25. void TreadSound (edict_t *self)
  26. {
  27.     gi.sound (self, CHAN_VOICE, tread_sound, 1, ATTN_NORM, 0);
  28. }
  29.  
  30. void supertank_search (edict_t *self)
  31. {
  32.     if (random() < 0.5)
  33.         gi.sound (self, CHAN_VOICE, sound_search1, 1, ATTN_NORM, 0);
  34.     else
  35.         gi.sound (self, CHAN_VOICE, sound_search2, 1, ATTN_NORM, 0);
  36. }
  37.  
  38.  
  39. void supertank_dead (edict_t *self);
  40. void supertankRocket (edict_t *self);
  41. void supertankMachineGun (edict_t *self);
  42. void supertank_reattack1(edict_t *self);
  43.  
  44.  
  45. //
  46. // stand
  47. //
  48.  
  49. mframe_t supertank_frames_stand []=
  50. {
  51.     ai_stand, 0, NULL,
  52.     ai_stand, 0, NULL,
  53.     ai_stand, 0, NULL,
  54.     ai_stand, 0, NULL,
  55.     ai_stand, 0, NULL,
  56.     ai_stand, 0, NULL,
  57.     ai_stand, 0, NULL,
  58.     ai_stand, 0, NULL,
  59.     ai_stand, 0, NULL,
  60.     ai_stand, 0, NULL,
  61.     ai_stand, 0, NULL,
  62.     ai_stand, 0, NULL,
  63.     ai_stand, 0, NULL,
  64.     ai_stand, 0, NULL,
  65.     ai_stand, 0, NULL,
  66.     ai_stand, 0, NULL,
  67.     ai_stand, 0, NULL,
  68.     ai_stand, 0, NULL,
  69.     ai_stand, 0, NULL,
  70.     ai_stand, 0, NULL,
  71.     ai_stand, 0, NULL,
  72.     ai_stand, 0, NULL,
  73.     ai_stand, 0, NULL,
  74.     ai_stand, 0, NULL,
  75.     ai_stand, 0, NULL,
  76.     ai_stand, 0, NULL,
  77.     ai_stand, 0, NULL,
  78.     ai_stand, 0, NULL,
  79.     ai_stand, 0, NULL,
  80.     ai_stand, 0, NULL,
  81.     ai_stand, 0, NULL,
  82.     ai_stand, 0, NULL,
  83.     ai_stand, 0, NULL,
  84.     ai_stand, 0, NULL,
  85.     ai_stand, 0, NULL,
  86.     ai_stand, 0, NULL,
  87.     ai_stand, 0, NULL,
  88.     ai_stand, 0, NULL,
  89.     ai_stand, 0, NULL,
  90.     ai_stand, 0, NULL,
  91.     ai_stand, 0, NULL,
  92.     ai_stand, 0, NULL,
  93.     ai_stand, 0, NULL,
  94.     ai_stand, 0, NULL,
  95.     ai_stand, 0, NULL,
  96.     ai_stand, 0, NULL,
  97.     ai_stand, 0, NULL,
  98.     ai_stand, 0, NULL,
  99.     ai_stand, 0, NULL,
  100.     ai_stand, 0, NULL,
  101.     ai_stand, 0, NULL,
  102.     ai_stand, 0, NULL,
  103.     ai_stand, 0, NULL,
  104.     ai_stand, 0, NULL,
  105.     ai_stand, 0, NULL,
  106.     ai_stand, 0, NULL,
  107.     ai_stand, 0, NULL,
  108.     ai_stand, 0, NULL,
  109.     ai_stand, 0, NULL,
  110.     ai_stand, 0, NULL
  111. };
  112. mmove_t    supertank_move_stand = {FRAME_stand_1, FRAME_stand_60, supertank_frames_stand, NULL};
  113.     
  114. void supertank_stand (edict_t *self)
  115. {
  116.     self->monsterinfo.currentmove = &supertank_move_stand;
  117. }
  118.  
  119.  
  120. mframe_t supertank_frames_run [] =
  121. {
  122.     ai_run, 12,    TreadSound,
  123.     ai_run, 12,    NULL,
  124.     ai_run, 12,    NULL,
  125.     ai_run, 12,    NULL,
  126.     ai_run, 12,    NULL,
  127.     ai_run, 12,    NULL,
  128.     ai_run, 12,    NULL,
  129.     ai_run, 12,    NULL,
  130.     ai_run, 12,    NULL,
  131.     ai_run, 12,    NULL,
  132.     ai_run, 12,    NULL,
  133.     ai_run, 12,    NULL,
  134.     ai_run, 12,    NULL,
  135.     ai_run, 12,    NULL,
  136.     ai_run, 12,    NULL,
  137.     ai_run, 12,    NULL,
  138.     ai_run, 12,    NULL,
  139.     ai_run, 12,    NULL
  140. };
  141. mmove_t    supertank_move_run = {FRAME_forwrd_1, FRAME_forwrd_18, supertank_frames_run, NULL};
  142.  
  143. //
  144. // walk
  145. //
  146.  
  147.  
  148. mframe_t supertank_frames_forward [] =
  149. {
  150.     ai_walk, 4,    TreadSound,
  151.     ai_walk, 4,    NULL,
  152.     ai_walk, 4,    NULL,
  153.     ai_walk, 4,    NULL,
  154.     ai_walk, 4,    NULL,
  155.     ai_walk, 4,    NULL,
  156.     ai_walk, 4,    NULL,
  157.     ai_walk, 4,    NULL,
  158.     ai_walk, 4,    NULL,
  159.     ai_walk, 4,    NULL,
  160.     ai_walk, 4,    NULL,
  161.     ai_walk, 4,    NULL,
  162.     ai_walk, 4,    NULL,
  163.     ai_walk, 4,    NULL,
  164.     ai_walk, 4,    NULL,
  165.     ai_walk, 4,    NULL,
  166.     ai_walk, 4,    NULL,
  167.     ai_walk, 4,    NULL
  168. };
  169. mmove_t    supertank_move_forward = {FRAME_forwrd_1, FRAME_forwrd_18, supertank_frames_forward, NULL};
  170.  
  171. void supertank_forward (edict_t *self)
  172. {
  173.         self->monsterinfo.currentmove = &supertank_move_forward;
  174. }
  175.  
  176. void supertank_walk (edict_t *self)
  177. {
  178.         self->monsterinfo.currentmove = &supertank_move_forward;
  179. }
  180.  
  181. void supertank_run (edict_t *self)
  182. {
  183.     if (self->monsterinfo.aiflags & AI_STAND_GROUND)
  184.         self->monsterinfo.currentmove = &supertank_move_stand;
  185.     else
  186.         self->monsterinfo.currentmove = &supertank_move_run;
  187. }
  188.  
  189. mframe_t supertank_frames_turn_right [] =
  190. {
  191.     ai_move,    0,    TreadSound,
  192.     ai_move,    0,    NULL,
  193.     ai_move,    0,    NULL,
  194.     ai_move,    0,    NULL,
  195.     ai_move,    0,    NULL,
  196.     ai_move,    0,    NULL,
  197.     ai_move,    0,    NULL,
  198.     ai_move,    0,    NULL,
  199.     ai_move,    0,    NULL,
  200.     ai_move,    0,    NULL,
  201.     ai_move,    0,    NULL,
  202.     ai_move,    0,    NULL,
  203.     ai_move,    0,    NULL,
  204.     ai_move,    0,    NULL,
  205.     ai_move,    0,    NULL,
  206.     ai_move,    0,    NULL,
  207.     ai_move,    0,    NULL,
  208.     ai_move,    0,    NULL
  209. };
  210. mmove_t supertank_move_turn_right = {FRAME_right_1, FRAME_right_18, supertank_frames_turn_right, supertank_run};
  211.  
  212. mframe_t supertank_frames_turn_left [] =
  213. {
  214.     ai_move,    0,    TreadSound,
  215.     ai_move,    0,    NULL,
  216.     ai_move,    0,    NULL,
  217.     ai_move,    0,    NULL,
  218.     ai_move,    0,    NULL,
  219.     ai_move,    0,    NULL,
  220.     ai_move,    0,    NULL,
  221.     ai_move,    0,    NULL,
  222.     ai_move,    0,    NULL,
  223.     ai_move,    0,    NULL,
  224.     ai_move,    0,    NULL,
  225.     ai_move,    0,    NULL,
  226.     ai_move,    0,    NULL,
  227.     ai_move,    0,    NULL,
  228.     ai_move,    0,    NULL,
  229.     ai_move,    0,    NULL,
  230.     ai_move,    0,    NULL,
  231.     ai_move,    0,    NULL
  232. };
  233. mmove_t supertank_move_turn_left = {FRAME_left_1, FRAME_left_18, supertank_frames_turn_left, supertank_run};
  234.  
  235.  
  236. mframe_t supertank_frames_pain3 [] =
  237. {
  238.     ai_move,    0,    NULL,
  239.     ai_move,    0,    NULL,
  240.     ai_move,    0,    NULL,
  241.     ai_move,    0,    NULL
  242. };
  243. mmove_t supertank_move_pain3 = {FRAME_pain3_9, FRAME_pain3_12, supertank_frames_pain3, supertank_run};
  244.  
  245. mframe_t supertank_frames_pain2 [] =
  246. {
  247.     ai_move,    0,    NULL,
  248.     ai_move,    0,    NULL,
  249.     ai_move,    0,    NULL,
  250.     ai_move,    0,    NULL
  251. };
  252. mmove_t supertank_move_pain2 = {FRAME_pain2_5, FRAME_pain2_8, supertank_frames_pain2, supertank_run};
  253.  
  254. mframe_t supertank_frames_pain1 [] =
  255. {
  256.     ai_move,    0,    NULL,
  257.     ai_move,    0,    NULL,
  258.     ai_move,    0,    NULL,
  259.     ai_move,    0,    NULL
  260. };
  261. mmove_t supertank_move_pain1 = {FRAME_pain1_1, FRAME_pain1_4, supertank_frames_pain1, supertank_run};
  262.  
  263. mframe_t supertank_frames_death1 [] =
  264. {
  265.     ai_move,    0,    NULL,
  266.     ai_move,    0,    NULL,
  267.     ai_move,    0,    NULL,
  268.     ai_move,    0,    NULL,
  269.     ai_move,    0,    NULL,
  270.     ai_move,    0,    NULL,
  271.     ai_move,    0,    NULL,
  272.     ai_move,    0,    NULL,
  273.     ai_move,    0,    NULL,
  274.     ai_move,    0,    NULL,
  275.     ai_move,    0,    NULL,
  276.     ai_move,    0,    NULL,
  277.     ai_move,    0,    NULL,
  278.     ai_move,    0,    NULL,
  279.     ai_move,    0,    NULL,
  280.     ai_move,    0,    NULL,
  281.     ai_move,    0,    NULL,
  282.     ai_move,    0,    NULL,
  283.     ai_move,    0,    NULL,
  284.     ai_move,    0,    NULL,
  285.     ai_move,    0,    NULL,
  286.     ai_move,    0,    NULL,
  287.     ai_move,    0,    NULL,
  288.     ai_move,    0,    BossExplode
  289. };
  290. mmove_t supertank_move_death = {FRAME_death_1, FRAME_death_24, supertank_frames_death1, supertank_dead};
  291.  
  292. mframe_t supertank_frames_backward[] =
  293. {
  294.     ai_walk, 0,    TreadSound,
  295.     ai_walk, 0,    NULL,
  296.     ai_walk, 0,    NULL,
  297.     ai_walk, 0,    NULL,
  298.     ai_walk, 0,    NULL,
  299.     ai_walk, 0,    NULL,
  300.     ai_walk, 0,    NULL,
  301.     ai_walk, 0,    NULL,
  302.     ai_walk, 0,    NULL,
  303.     ai_walk, 0,    NULL,
  304.     ai_walk, 0,    NULL,
  305.     ai_walk, 0,    NULL,
  306.     ai_walk, 0,    NULL,
  307.     ai_walk, 0,    NULL,
  308.     ai_walk, 0,    NULL,
  309.     ai_walk, 0,    NULL,
  310.     ai_walk, 0,    NULL,
  311.     ai_walk, 0,    NULL
  312. };
  313. mmove_t    supertank_move_backward = {FRAME_backwd_1, FRAME_backwd_18, supertank_frames_backward, NULL};
  314.  
  315. mframe_t supertank_frames_attack4[]=
  316. {
  317.     ai_move,    0,    NULL,
  318.     ai_move,    0,    NULL,
  319.     ai_move,    0,    NULL,
  320.     ai_move,    0,    NULL,
  321.     ai_move,    0,    NULL,
  322.     ai_move,    0,    NULL
  323. };
  324. mmove_t supertank_move_attack4 = {FRAME_attak4_1, FRAME_attak4_6, supertank_frames_attack4, supertank_run};
  325.  
  326. mframe_t supertank_frames_attack3[]=
  327. {
  328.     ai_move,    0,    NULL,
  329.     ai_move,    0,    NULL,
  330.     ai_move,    0,    NULL,
  331.     ai_move,    0,    NULL,
  332.     ai_move,    0,    NULL,
  333.     ai_move,    0,    NULL,
  334.     ai_move,    0,    NULL,
  335.     ai_move,    0,    NULL,
  336.     ai_move,    0,    NULL,
  337.     ai_move,    0,    NULL,
  338.     ai_move,    0,    NULL,
  339.     ai_move,    0,    NULL,
  340.     ai_move,    0,    NULL,
  341.     ai_move,    0,    NULL,
  342.     ai_move,    0,    NULL,
  343.     ai_move,    0,    NULL,
  344.     ai_move,    0,    NULL,
  345.     ai_move,    0,    NULL,
  346.     ai_move,    0,    NULL,
  347.     ai_move,    0,    NULL,
  348.     ai_move,    0,    NULL,
  349.     ai_move,    0,    NULL,
  350.     ai_move,    0,    NULL,
  351.     ai_move,    0,    NULL,
  352.     ai_move,    0,    NULL,
  353.     ai_move,    0,    NULL,
  354.     ai_move,    0,    NULL
  355. };
  356. mmove_t supertank_move_attack3 = {FRAME_attak3_1, FRAME_attak3_27, supertank_frames_attack3, supertank_run};
  357.  
  358. mframe_t supertank_frames_attack2[]=
  359. {
  360.     ai_charge,    0,    NULL,
  361.     ai_charge,    0,    NULL,
  362.     ai_charge,    0,    NULL,
  363.     ai_charge,    0,    NULL,
  364.     ai_charge,    0,    NULL,
  365.     ai_charge,    0,    NULL,
  366.     ai_charge,    0,    NULL,
  367.     ai_charge,    0,    supertankRocket,
  368.     ai_move,    0,    NULL,
  369.     ai_move,    0,    NULL,
  370.     ai_move,    0,    supertankRocket,
  371.     ai_move,    0,    NULL,
  372.     ai_move,    0,    NULL,
  373.     ai_move,    0,    supertankRocket,
  374.     ai_move,    0,    NULL,
  375.     ai_move,    0,    NULL,
  376.     ai_move,    0,    NULL,
  377.     ai_move,    0,    NULL,
  378.     ai_move,    0,    NULL,
  379.     ai_move,    0,    NULL,
  380.     ai_move,    0,    NULL,
  381.     ai_move,    0,    NULL,
  382.     ai_move,    0,    NULL,
  383.     ai_move,    0,    NULL,
  384.     ai_move,    0,    NULL,
  385.     ai_move,    0,    NULL,
  386.     ai_move,    0,    NULL
  387. };
  388. mmove_t supertank_move_attack2 = {FRAME_attak2_1, FRAME_attak2_27, supertank_frames_attack2, supertank_run};
  389.  
  390. mframe_t supertank_frames_attack1[]=
  391. {
  392.     ai_charge,    0,    supertankMachineGun,
  393.     ai_charge,    0,    supertankMachineGun,
  394.     ai_charge,    0,    supertankMachineGun,
  395.     ai_charge,    0,    supertankMachineGun,
  396.     ai_charge,    0,    supertankMachineGun,
  397.     ai_charge,    0,    supertankMachineGun,
  398.  
  399. };
  400. mmove_t supertank_move_attack1 = {FRAME_attak1_1, FRAME_attak1_6, supertank_frames_attack1, supertank_reattack1};
  401.  
  402. mframe_t supertank_frames_end_attack1[]=
  403. {
  404.     ai_move,    0,    NULL,
  405.     ai_move,    0,    NULL,
  406.     ai_move,    0,    NULL,
  407.     ai_move,    0,    NULL,
  408.     ai_move,    0,    NULL,
  409.     ai_move,    0,    NULL,
  410.     ai_move,    0,    NULL,
  411.     ai_move,    0,    NULL,
  412.     ai_move,    0,    NULL,
  413.     ai_move,    0,    NULL,
  414.     ai_move,    0,    NULL,
  415.     ai_move,    0,    NULL,
  416.     ai_move,    0,    NULL,
  417.     ai_move,    0,    NULL
  418. };
  419. mmove_t supertank_move_end_attack1 = {FRAME_attak1_7, FRAME_attak1_20, supertank_frames_end_attack1, supertank_run};
  420.  
  421.  
  422. void supertank_reattack1(edict_t *self)
  423. {
  424.     if (visible(self, self->enemy))
  425.         if (random() < 0.9)
  426.             self->monsterinfo.currentmove = &supertank_move_attack1;
  427.         else
  428.             self->monsterinfo.currentmove = &supertank_move_end_attack1;    
  429.     else
  430.         self->monsterinfo.currentmove = &supertank_move_end_attack1;
  431. }
  432.  
  433. void supertank_pain (edict_t *self, edict_t *other, float kick, int damage)
  434. {
  435.  
  436.     if (self->health < (self->max_health / 2))
  437.             self->s.skinnum = 1;
  438.  
  439.     if (level.time < self->pain_debounce_time)
  440.             return;
  441.  
  442.     // Lessen the chance of him going into his pain frames
  443.     if (damage <=25)
  444.         if (random()<0.2)
  445.             return;
  446.  
  447.     // Don't go into pain if he's firing his rockets
  448.     if (skill->value >= 2)
  449.         if ( (self->s.frame >= FRAME_attak2_1) && (self->s.frame <= FRAME_attak2_14) )
  450.             return;
  451.  
  452.     self->pain_debounce_time = level.time + 3;
  453.  
  454.     if (damage <= 10)
  455.     {
  456.         gi.sound (self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM,0);
  457.         self->monsterinfo.currentmove = &supertank_move_pain1;
  458.     }
  459.     else if (damage <= 25)
  460.     {
  461.         gi.sound (self, CHAN_VOICE, sound_pain3, 1, ATTN_NORM,0);
  462.         self->monsterinfo.currentmove = &supertank_move_pain2;
  463.     }
  464.     else
  465.     {
  466.         gi.sound (self, CHAN_VOICE, sound_pain2, 1, ATTN_NORM,0);
  467.         self->monsterinfo.currentmove = &supertank_move_pain3;
  468.     }
  469. }
  470.  
  471.  
  472. void supertankRocket (edict_t *self)
  473. {
  474.     vec3_t    forward, right;
  475.     vec3_t    start;
  476.     vec3_t    dir;
  477.     vec3_t    vec;
  478.     int        flash_number;
  479.  
  480.     if (self->s.frame == FRAME_attak2_8)
  481.         flash_number = MZ2_SUPERTANK_ROCKET_1;
  482.     else if (self->s.frame == FRAME_attak2_11)
  483.         flash_number = MZ2_SUPERTANK_ROCKET_2;
  484.     else // (self->s.frame == FRAME_attak2_14)
  485.         flash_number = MZ2_SUPERTANK_ROCKET_3;
  486.  
  487.     AngleVectors (self->s.angles, forward, right, NULL);
  488.     G_ProjectSource (self->s.origin, monster_flash_offset[flash_number], forward, right, start);
  489.  
  490.     VectorCopy (self->enemy->s.origin, vec);
  491.     vec[2] += self->enemy->viewheight;
  492.     VectorSubtract (vec, start, dir);
  493.     VectorNormalize (dir);
  494.  
  495.     monster_fire_rocket (self, start, dir, 50, 500, flash_number);
  496. }    
  497.  
  498. void supertankMachineGun (edict_t *self)
  499. {
  500.     vec3_t    dir;
  501.     vec3_t    vec;
  502.     vec3_t    start;
  503.     vec3_t    forward, right;
  504.     int        flash_number;
  505.  
  506.     flash_number = MZ2_SUPERTANK_MACHINEGUN_1 + (self->s.frame - FRAME_attak1_1);
  507.  
  508.     //FIXME!!!
  509.     dir[0] = 0;
  510.     dir[1] = self->s.angles[1];
  511.     dir[2] = 0;
  512.  
  513.     AngleVectors (dir, forward, right, NULL);
  514.     G_ProjectSource (self->s.origin, monster_flash_offset[flash_number], forward, right, start);
  515.  
  516.     if (self->enemy)
  517.     {
  518.         VectorCopy (self->enemy->s.origin, vec);
  519.         VectorMA (vec, 0, self->enemy->velocity, vec);
  520.         vec[2] += self->enemy->viewheight;
  521.         VectorSubtract (vec, start, forward);
  522.         VectorNormalize (forward);
  523.   }
  524.  
  525.     monster_fire_bullet (self, start, forward, 6, 4, DEFAULT_BULLET_HSPREAD, DEFAULT_BULLET_VSPREAD, flash_number);
  526. }    
  527.  
  528.  
  529. void supertank_attack(edict_t *self)
  530. {
  531.     vec3_t    vec;
  532.     float    range;
  533.     //float    r;
  534.  
  535.     VectorSubtract (self->enemy->s.origin, self->s.origin, vec);
  536.     range = VectorLength (vec);
  537.  
  538.     //r = random();
  539.  
  540.     // Attack 1 == Chaingun
  541.     // Attack 2 == Rocket Launcher
  542.  
  543.     if (range <= 160)
  544.     {
  545.         self->monsterinfo.currentmove = &supertank_move_attack1;
  546.     }
  547.     else
  548.     {    // fire rockets more often at distance
  549.         if (random() < 0.3)
  550.             self->monsterinfo.currentmove = &supertank_move_attack1;
  551.         else
  552.             self->monsterinfo.currentmove = &supertank_move_attack2;
  553.     }
  554. }
  555.  
  556.  
  557. //
  558. // death
  559. //
  560.  
  561. void supertank_dead (edict_t *self)
  562. {
  563.     /*
  564.     VectorSet (self->mins, -16, -16, -24);
  565.     VectorSet (self->maxs, 16, 16, -8);
  566.     */
  567.     VectorSet (self->mins, -60, -60, 0);
  568.     VectorSet (self->maxs, 60, 60, 72);
  569.     self->movetype = MOVETYPE_TOSS;
  570.     self->nextthink = 0;
  571.     gi.linkentity (self);
  572. }
  573.  
  574.  
  575. void BossExplode (edict_t *self)
  576. {
  577.     vec3_t    org;
  578.     int        n;
  579.  
  580.     self->think = BossExplode;
  581.     VectorCopy (self->s.origin, org);
  582.     org[2] += 24 + (rand()&15);
  583.     switch (self->count++)
  584.     {
  585.     case 0:
  586.         org[0] -= 24;
  587.         org[1] -= 24;
  588.         break;
  589.     case 1:
  590.         org[0] += 24;
  591.         org[1] += 24;
  592.         break;
  593.     case 2:
  594.         org[0] += 24;
  595.         org[1] -= 24;
  596.         break;
  597.     case 3:
  598.         org[0] -= 24;
  599.         org[1] += 24;
  600.         break;
  601.     case 4:
  602.         org[0] -= 48;
  603.         org[1] -= 48;
  604.         break;
  605.     case 5:
  606.         org[0] += 48;
  607.         org[1] += 48;
  608.         break;
  609.     case 6:
  610.         org[0] -= 48;
  611.         org[1] += 48;
  612.         break;
  613.     case 7:
  614.         org[0] += 48;
  615.         org[1] -= 48;
  616.         break;
  617.     case 8:
  618.         self->s.sound = 0;
  619.         for (n= 0; n < 4; n++)
  620.             ThrowGib (self, "models/objects/gibs/sm_meat/tris.md2", 500, GIB_ORGANIC);
  621.         for (n= 0; n < 8; n++)
  622.             ThrowGib (self, "models/objects/gibs/sm_metal/tris.md2", 500, GIB_METALLIC);
  623.         ThrowGib (self, "models/objects/gibs/chest/tris.md2", 500, GIB_ORGANIC);
  624.         ThrowHead (self, "models/objects/gibs/gear/tris.md2", 500, GIB_METALLIC);
  625.         self->deadflag = DEAD_DEAD;
  626.         return;
  627.     }
  628.  
  629.     gi.WriteByte (svc_temp_entity);
  630.     gi.WriteByte (TE_EXPLOSION1);
  631.     gi.WritePosition (org);
  632.     gi.multicast (self->s.origin, MULTICAST_PVS);
  633.  
  634.     self->nextthink = level.time + 0.1;
  635. }
  636.  
  637.  
  638. void supertank_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point)
  639. {
  640.     gi.sound (self, CHAN_VOICE, sound_death, 1, ATTN_NORM, 0);
  641.     self->deadflag = DEAD_DEAD;
  642.     self->takedamage = DAMAGE_NO;
  643.     self->count = 0;
  644.     self->monsterinfo.currentmove = &supertank_move_death;
  645. }
  646.  
  647. //
  648. // monster_supertank
  649. //
  650.  
  651. /*QUAKED monster_supertank (1 .5 0) (-64 -64 0) (64 64 72) Ambush Trigger_Spawn Sight
  652. */
  653. void SP_monster_supertank (edict_t *self)
  654. {
  655.     if (deathmatch->value)
  656.     {
  657.         G_FreeEdict (self);
  658.         return;
  659.     }
  660.  
  661.     sound_pain1 = gi.soundindex ("bosstank/btkpain1.wav");
  662.     sound_pain2 = gi.soundindex ("bosstank/btkpain2.wav");
  663.     sound_pain3 = gi.soundindex ("bosstank/btkpain3.wav");
  664.     sound_death = gi.soundindex ("bosstank/btkdeth1.wav");
  665.     sound_search1 = gi.soundindex ("bosstank/btkunqv1.wav");
  666.     sound_search2 = gi.soundindex ("bosstank/btkunqv2.wav");
  667.  
  668. //    self->s.sound = gi.soundindex ("bosstank/btkengn1.wav");
  669.     tread_sound = gi.soundindex ("bosstank/btkengn1.wav");
  670.  
  671.     self->movetype = MOVETYPE_STEP;
  672.     self->solid = SOLID_BBOX;
  673.     self->s.modelindex = gi.modelindex ("models/monsters/boss1/tris.md2");
  674.     VectorSet (self->mins, -64, -64, 0);
  675.     VectorSet (self->maxs, 64, 64, 112);
  676.  
  677.     self->health = 1500;
  678.     self->gib_health = -500;
  679.     self->mass = 800;
  680.  
  681.     self->pain = supertank_pain;
  682.     self->die = supertank_die;
  683.     self->monsterinfo.stand = supertank_stand;
  684.     self->monsterinfo.walk = supertank_walk;
  685.     self->monsterinfo.run = supertank_run;
  686.     self->monsterinfo.dodge = NULL;
  687.     self->monsterinfo.attack = supertank_attack;
  688.     self->monsterinfo.search = supertank_search;
  689.     self->monsterinfo.melee = NULL;
  690.     self->monsterinfo.sight = NULL;
  691.  
  692.     gi.linkentity (self);
  693.     
  694.     self->monsterinfo.currentmove = &supertank_move_stand;
  695.     self->monsterinfo.scale = MODEL_SCALE;
  696.  
  697.     walkmonster_start(self);
  698. }
  699.