m_supertank.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718
  1. /*
  2. Copyright (C) 1997-2001 Id Software, Inc.
  3. This program is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU General Public License
  5. as published by the Free Software Foundation; either version 2
  6. of the License, or (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. See the GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  14. */
  15. /*
  16. ==============================================================================
  17. SUPERTANK
  18. ==============================================================================
  19. */
  20. #include "g_local.h"
  21. #include "m_supertank.h"
  22. qboolean visible (edict_t *self, edict_t *other);
  23. static int sound_pain1;
  24. static int sound_pain2;
  25. static int sound_pain3;
  26. static int sound_death;
  27. static int sound_search1;
  28. static int sound_search2;
  29. static int tread_sound;
  30. void BossExplode (edict_t *self);
  31. void TreadSound (edict_t *self)
  32. {
  33. gi.sound (self, CHAN_VOICE, tread_sound, 1, ATTN_NORM, 0);
  34. }
  35. void supertank_search (edict_t *self)
  36. {
  37. if (random() < 0.5)
  38. gi.sound (self, CHAN_VOICE, sound_search1, 1, ATTN_NORM, 0);
  39. else
  40. gi.sound (self, CHAN_VOICE, sound_search2, 1, ATTN_NORM, 0);
  41. }
  42. void supertank_dead (edict_t *self);
  43. void supertankRocket (edict_t *self);
  44. void supertankMachineGun (edict_t *self);
  45. void supertank_reattack1(edict_t *self);
  46. //
  47. // stand
  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. void supertank_stand (edict_t *self)
  114. {
  115. self->monsterinfo.currentmove = &supertank_move_stand;
  116. }
  117. mframe_t supertank_frames_run [] =
  118. {
  119. ai_run, 12, TreadSound,
  120. ai_run, 12, NULL,
  121. ai_run, 12, NULL,
  122. ai_run, 12, NULL,
  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. };
  138. mmove_t supertank_move_run = {FRAME_forwrd_1, FRAME_forwrd_18, supertank_frames_run, NULL};
  139. //
  140. // walk
  141. //
  142. mframe_t supertank_frames_forward [] =
  143. {
  144. ai_walk, 4, TreadSound,
  145. ai_walk, 4, NULL,
  146. ai_walk, 4, NULL,
  147. ai_walk, 4, NULL,
  148. ai_walk, 4, NULL,
  149. ai_walk, 4, NULL,
  150. ai_walk, 4, NULL,
  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. };
  163. mmove_t supertank_move_forward = {FRAME_forwrd_1, FRAME_forwrd_18, supertank_frames_forward, NULL};
  164. void supertank_forward (edict_t *self)
  165. {
  166. self->monsterinfo.currentmove = &supertank_move_forward;
  167. }
  168. void supertank_walk (edict_t *self)
  169. {
  170. self->monsterinfo.currentmove = &supertank_move_forward;
  171. }
  172. void supertank_run (edict_t *self)
  173. {
  174. if (self->monsterinfo.aiflags & AI_STAND_GROUND)
  175. self->monsterinfo.currentmove = &supertank_move_stand;
  176. else
  177. self->monsterinfo.currentmove = &supertank_move_run;
  178. }
  179. mframe_t supertank_frames_turn_right [] =
  180. {
  181. ai_move, 0, TreadSound,
  182. ai_move, 0, NULL,
  183. ai_move, 0, NULL,
  184. ai_move, 0, NULL,
  185. ai_move, 0, NULL,
  186. ai_move, 0, NULL,
  187. ai_move, 0, NULL,
  188. ai_move, 0, NULL,
  189. ai_move, 0, NULL,
  190. ai_move, 0, NULL,
  191. ai_move, 0, NULL,
  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. };
  200. mmove_t supertank_move_turn_right = {FRAME_right_1, FRAME_right_18, supertank_frames_turn_right, supertank_run};
  201. mframe_t supertank_frames_turn_left [] =
  202. {
  203. ai_move, 0, TreadSound,
  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. ai_move, 0, NULL,
  210. ai_move, 0, NULL,
  211. ai_move, 0, NULL,
  212. ai_move, 0, NULL,
  213. ai_move, 0, NULL,
  214. ai_move, 0, NULL,
  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. };
  222. mmove_t supertank_move_turn_left = {FRAME_left_1, FRAME_left_18, supertank_frames_turn_left, supertank_run};
  223. mframe_t supertank_frames_pain3 [] =
  224. {
  225. ai_move, 0, NULL,
  226. ai_move, 0, NULL,
  227. ai_move, 0, NULL,
  228. ai_move, 0, NULL
  229. };
  230. mmove_t supertank_move_pain3 = {FRAME_pain3_9, FRAME_pain3_12, supertank_frames_pain3, supertank_run};
  231. mframe_t supertank_frames_pain2 [] =
  232. {
  233. ai_move, 0, NULL,
  234. ai_move, 0, NULL,
  235. ai_move, 0, NULL,
  236. ai_move, 0, NULL
  237. };
  238. mmove_t supertank_move_pain2 = {FRAME_pain2_5, FRAME_pain2_8, supertank_frames_pain2, supertank_run};
  239. mframe_t supertank_frames_pain1 [] =
  240. {
  241. ai_move, 0, NULL,
  242. ai_move, 0, NULL,
  243. ai_move, 0, NULL,
  244. ai_move, 0, NULL
  245. };
  246. mmove_t supertank_move_pain1 = {FRAME_pain1_1, FRAME_pain1_4, supertank_frames_pain1, supertank_run};
  247. mframe_t supertank_frames_death1 [] =
  248. {
  249. ai_move, 0, NULL,
  250. ai_move, 0, NULL,
  251. ai_move, 0, NULL,
  252. ai_move, 0, NULL,
  253. ai_move, 0, NULL,
  254. ai_move, 0, NULL,
  255. ai_move, 0, NULL,
  256. ai_move, 0, NULL,
  257. ai_move, 0, NULL,
  258. ai_move, 0, NULL,
  259. ai_move, 0, NULL,
  260. ai_move, 0, NULL,
  261. ai_move, 0, NULL,
  262. ai_move, 0, NULL,
  263. ai_move, 0, NULL,
  264. ai_move, 0, NULL,
  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, BossExplode
  273. };
  274. mmove_t supertank_move_death = {FRAME_death_1, FRAME_death_24, supertank_frames_death1, supertank_dead};
  275. mframe_t supertank_frames_backward[] =
  276. {
  277. ai_walk, 0, TreadSound,
  278. ai_walk, 0, NULL,
  279. ai_walk, 0, NULL,
  280. ai_walk, 0, NULL,
  281. ai_walk, 0, NULL,
  282. ai_walk, 0, NULL,
  283. ai_walk, 0, NULL,
  284. ai_walk, 0, NULL,
  285. ai_walk, 0, NULL,
  286. ai_walk, 0, NULL,
  287. ai_walk, 0, NULL,
  288. ai_walk, 0, NULL,
  289. ai_walk, 0, NULL,
  290. ai_walk, 0, NULL,
  291. ai_walk, 0, NULL,
  292. ai_walk, 0, NULL,
  293. ai_walk, 0, NULL,
  294. ai_walk, 0, NULL
  295. };
  296. mmove_t supertank_move_backward = {FRAME_backwd_1, FRAME_backwd_18, supertank_frames_backward, NULL};
  297. mframe_t supertank_frames_attack4[]=
  298. {
  299. ai_move, 0, NULL,
  300. ai_move, 0, NULL,
  301. ai_move, 0, NULL,
  302. ai_move, 0, NULL,
  303. ai_move, 0, NULL,
  304. ai_move, 0, NULL
  305. };
  306. mmove_t supertank_move_attack4 = {FRAME_attak4_1, FRAME_attak4_6, supertank_frames_attack4, supertank_run};
  307. mframe_t supertank_frames_attack3[]=
  308. {
  309. ai_move, 0, NULL,
  310. ai_move, 0, NULL,
  311. ai_move, 0, NULL,
  312. ai_move, 0, NULL,
  313. ai_move, 0, NULL,
  314. ai_move, 0, NULL,
  315. ai_move, 0, NULL,
  316. ai_move, 0, NULL,
  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. ai_move, 0, NULL,
  324. ai_move, 0, NULL,
  325. ai_move, 0, NULL,
  326. ai_move, 0, NULL,
  327. ai_move, 0, NULL,
  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. };
  337. mmove_t supertank_move_attack3 = {FRAME_attak3_1, FRAME_attak3_27, supertank_frames_attack3, supertank_run};
  338. mframe_t supertank_frames_attack2[]=
  339. {
  340. ai_charge, 0, NULL,
  341. ai_charge, 0, NULL,
  342. ai_charge, 0, NULL,
  343. ai_charge, 0, NULL,
  344. ai_charge, 0, NULL,
  345. ai_charge, 0, NULL,
  346. ai_charge, 0, NULL,
  347. ai_charge, 0, supertankRocket,
  348. ai_move, 0, NULL,
  349. ai_move, 0, NULL,
  350. ai_move, 0, supertankRocket,
  351. ai_move, 0, NULL,
  352. ai_move, 0, NULL,
  353. ai_move, 0, supertankRocket,
  354. ai_move, 0, NULL,
  355. ai_move, 0, NULL,
  356. ai_move, 0, NULL,
  357. ai_move, 0, NULL,
  358. ai_move, 0, NULL,
  359. ai_move, 0, NULL,
  360. ai_move, 0, NULL,
  361. ai_move, 0, NULL,
  362. ai_move, 0, NULL,
  363. ai_move, 0, NULL,
  364. ai_move, 0, NULL,
  365. ai_move, 0, NULL,
  366. ai_move, 0, NULL
  367. };
  368. mmove_t supertank_move_attack2 = {FRAME_attak2_1, FRAME_attak2_27, supertank_frames_attack2, supertank_run};
  369. mframe_t supertank_frames_attack1[]=
  370. {
  371. ai_charge, 0, supertankMachineGun,
  372. ai_charge, 0, supertankMachineGun,
  373. ai_charge, 0, supertankMachineGun,
  374. ai_charge, 0, supertankMachineGun,
  375. ai_charge, 0, supertankMachineGun,
  376. ai_charge, 0, supertankMachineGun,
  377. };
  378. mmove_t supertank_move_attack1 = {FRAME_attak1_1, FRAME_attak1_6, supertank_frames_attack1, supertank_reattack1};
  379. mframe_t supertank_frames_end_attack1[]=
  380. {
  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. ai_move, 0, NULL,
  388. ai_move, 0, NULL,
  389. ai_move, 0, NULL,
  390. ai_move, 0, NULL,
  391. ai_move, 0, NULL,
  392. ai_move, 0, NULL,
  393. ai_move, 0, NULL,
  394. ai_move, 0, NULL
  395. };
  396. mmove_t supertank_move_end_attack1 = {FRAME_attak1_7, FRAME_attak1_20, supertank_frames_end_attack1, supertank_run};
  397. void supertank_reattack1(edict_t *self)
  398. {
  399. if (visible(self, self->enemy))
  400. if (random() < 0.9)
  401. self->monsterinfo.currentmove = &supertank_move_attack1;
  402. else
  403. self->monsterinfo.currentmove = &supertank_move_end_attack1;
  404. else
  405. self->monsterinfo.currentmove = &supertank_move_end_attack1;
  406. }
  407. void supertank_pain (edict_t *self, edict_t *other, float kick, int damage)
  408. {
  409. if (self->health < (self->max_health / 2))
  410. self->s.skinnum = 1;
  411. if (level.time < self->pain_debounce_time)
  412. return;
  413. // Lessen the chance of him going into his pain frames
  414. if (damage <=25)
  415. if (random()<0.2)
  416. return;
  417. // Don't go into pain if he's firing his rockets
  418. if (skill->value >= 2)
  419. if ( (self->s.frame >= FRAME_attak2_1) && (self->s.frame <= FRAME_attak2_14) )
  420. return;
  421. self->pain_debounce_time = level.time + 3;
  422. if (skill->value == 3)
  423. return; // no pain anims in nightmare
  424. if (damage <= 10)
  425. {
  426. gi.sound (self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM,0);
  427. self->monsterinfo.currentmove = &supertank_move_pain1;
  428. }
  429. else if (damage <= 25)
  430. {
  431. gi.sound (self, CHAN_VOICE, sound_pain3, 1, ATTN_NORM,0);
  432. self->monsterinfo.currentmove = &supertank_move_pain2;
  433. }
  434. else
  435. {
  436. gi.sound (self, CHAN_VOICE, sound_pain2, 1, ATTN_NORM,0);
  437. self->monsterinfo.currentmove = &supertank_move_pain3;
  438. }
  439. };
  440. void supertankRocket (edict_t *self)
  441. {
  442. vec3_t forward, right;
  443. vec3_t start;
  444. vec3_t dir;
  445. vec3_t vec;
  446. int flash_number;
  447. if (self->s.frame == FRAME_attak2_8)
  448. flash_number = MZ2_SUPERTANK_ROCKET_1;
  449. else if (self->s.frame == FRAME_attak2_11)
  450. flash_number = MZ2_SUPERTANK_ROCKET_2;
  451. else // (self->s.frame == FRAME_attak2_14)
  452. flash_number = MZ2_SUPERTANK_ROCKET_3;
  453. AngleVectors (self->s.angles, forward, right, NULL);
  454. G_ProjectSource (self->s.origin, monster_flash_offset[flash_number], forward, right, start);
  455. VectorCopy (self->enemy->s.origin, vec);
  456. vec[2] += self->enemy->viewheight;
  457. VectorSubtract (vec, start, dir);
  458. VectorNormalize (dir);
  459. monster_fire_rocket (self, start, dir, 50, 500, flash_number);
  460. }
  461. void supertankMachineGun (edict_t *self)
  462. {
  463. vec3_t dir;
  464. vec3_t vec;
  465. vec3_t start;
  466. vec3_t forward, right;
  467. int flash_number;
  468. flash_number = MZ2_SUPERTANK_MACHINEGUN_1 + (self->s.frame - FRAME_attak1_1);
  469. //FIXME!!!
  470. dir[0] = 0;
  471. dir[1] = self->s.angles[1];
  472. dir[2] = 0;
  473. AngleVectors (dir, forward, right, NULL);
  474. G_ProjectSource (self->s.origin, monster_flash_offset[flash_number], forward, right, start);
  475. if (self->enemy)
  476. {
  477. VectorCopy (self->enemy->s.origin, vec);
  478. VectorMA (vec, 0, self->enemy->velocity, vec);
  479. vec[2] += self->enemy->viewheight;
  480. VectorSubtract (vec, start, forward);
  481. VectorNormalize (forward);
  482. }
  483. monster_fire_bullet (self, start, forward, 6, 4, DEFAULT_BULLET_HSPREAD, DEFAULT_BULLET_VSPREAD, flash_number);
  484. }
  485. void supertank_attack(edict_t *self)
  486. {
  487. vec3_t vec;
  488. float range;
  489. //float r;
  490. VectorSubtract (self->enemy->s.origin, self->s.origin, vec);
  491. range = VectorLength (vec);
  492. //r = random();
  493. // Attack 1 == Chaingun
  494. // Attack 2 == Rocket Launcher
  495. if (range <= 160)
  496. {
  497. self->monsterinfo.currentmove = &supertank_move_attack1;
  498. }
  499. else
  500. { // fire rockets more often at distance
  501. if (random() < 0.3)
  502. self->monsterinfo.currentmove = &supertank_move_attack1;
  503. else
  504. self->monsterinfo.currentmove = &supertank_move_attack2;
  505. }
  506. }
  507. //
  508. // death
  509. //
  510. void supertank_dead (edict_t *self)
  511. {
  512. VectorSet (self->mins, -60, -60, 0);
  513. VectorSet (self->maxs, 60, 60, 72);
  514. self->movetype = MOVETYPE_TOSS;
  515. self->svflags |= SVF_DEADMONSTER;
  516. self->nextthink = 0;
  517. gi.linkentity (self);
  518. }
  519. void BossExplode (edict_t *self)
  520. {
  521. vec3_t org;
  522. int n;
  523. self->think = BossExplode;
  524. VectorCopy (self->s.origin, org);
  525. org[2] += 24 + (rand()&15);
  526. switch (self->count++)
  527. {
  528. case 0:
  529. org[0] -= 24;
  530. org[1] -= 24;
  531. break;
  532. case 1:
  533. org[0] += 24;
  534. org[1] += 24;
  535. break;
  536. case 2:
  537. org[0] += 24;
  538. org[1] -= 24;
  539. break;
  540. case 3:
  541. org[0] -= 24;
  542. org[1] += 24;
  543. break;
  544. case 4:
  545. org[0] -= 48;
  546. org[1] -= 48;
  547. break;
  548. case 5:
  549. org[0] += 48;
  550. org[1] += 48;
  551. break;
  552. case 6:
  553. org[0] -= 48;
  554. org[1] += 48;
  555. break;
  556. case 7:
  557. org[0] += 48;
  558. org[1] -= 48;
  559. break;
  560. case 8:
  561. self->s.sound = 0;
  562. for (n= 0; n < 4; n++)
  563. ThrowGib (self, "models/objects/gibs/sm_meat/tris.md2", 500, GIB_ORGANIC);
  564. for (n= 0; n < 8; n++)
  565. ThrowGib (self, "models/objects/gibs/sm_metal/tris.md2", 500, GIB_METALLIC);
  566. ThrowGib (self, "models/objects/gibs/chest/tris.md2", 500, GIB_ORGANIC);
  567. ThrowHead (self, "models/objects/gibs/gear/tris.md2", 500, GIB_METALLIC);
  568. self->deadflag = DEAD_DEAD;
  569. return;
  570. }
  571. gi.WriteByte (svc_temp_entity);
  572. gi.WriteByte (TE_EXPLOSION1);
  573. gi.WritePosition (org);
  574. gi.multicast (self->s.origin, MULTICAST_PVS);
  575. self->nextthink = level.time + 0.1;
  576. }
  577. void supertank_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point)
  578. {
  579. gi.sound (self, CHAN_VOICE, sound_death, 1, ATTN_NORM, 0);
  580. self->deadflag = DEAD_DEAD;
  581. self->takedamage = DAMAGE_NO;
  582. self->count = 0;
  583. self->monsterinfo.currentmove = &supertank_move_death;
  584. }
  585. //
  586. // monster_supertank
  587. //
  588. /*QUAKED monster_supertank (1 .5 0) (-64 -64 0) (64 64 72) Ambush Trigger_Spawn Sight
  589. */
  590. void SP_monster_supertank (edict_t *self)
  591. {
  592. if (deathmatch->value)
  593. {
  594. G_FreeEdict (self);
  595. return;
  596. }
  597. sound_pain1 = gi.soundindex ("bosstank/btkpain1.wav");
  598. sound_pain2 = gi.soundindex ("bosstank/btkpain2.wav");
  599. sound_pain3 = gi.soundindex ("bosstank/btkpain3.wav");
  600. sound_death = gi.soundindex ("bosstank/btkdeth1.wav");
  601. sound_search1 = gi.soundindex ("bosstank/btkunqv1.wav");
  602. sound_search2 = gi.soundindex ("bosstank/btkunqv2.wav");
  603. // self->s.sound = gi.soundindex ("bosstank/btkengn1.wav");
  604. tread_sound = gi.soundindex ("bosstank/btkengn1.wav");
  605. self->movetype = MOVETYPE_STEP;
  606. self->solid = SOLID_BBOX;
  607. self->s.modelindex = gi.modelindex ("models/monsters/boss1/tris.md2");
  608. VectorSet (self->mins, -64, -64, 0);
  609. VectorSet (self->maxs, 64, 64, 112);
  610. self->health = 1500;
  611. self->gib_health = -500;
  612. self->mass = 800;
  613. self->pain = supertank_pain;
  614. self->die = supertank_die;
  615. self->monsterinfo.stand = supertank_stand;
  616. self->monsterinfo.walk = supertank_walk;
  617. self->monsterinfo.run = supertank_run;
  618. self->monsterinfo.dodge = NULL;
  619. self->monsterinfo.attack = supertank_attack;
  620. self->monsterinfo.search = supertank_search;
  621. self->monsterinfo.melee = NULL;
  622. self->monsterinfo.sight = NULL;
  623. gi.linkentity (self);
  624. self->monsterinfo.currentmove = &supertank_move_stand;
  625. self->monsterinfo.scale = MODEL_SCALE;
  626. walkmonster_start(self);
  627. }