m_supertank.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728
  1. // Copyright (c) ZeniMax Media Inc.
  2. // Licensed under the GNU General Public License 2.0.
  3. /*
  4. ==============================================================================
  5. SUPERTANK
  6. ==============================================================================
  7. */
  8. #include "g_local.h"
  9. #include "m_supertank.h"
  10. qboolean visible (edict_t *self, edict_t *other);
  11. static int sound_pain1;
  12. static int sound_pain2;
  13. static int sound_pain3;
  14. static int sound_death;
  15. static int sound_search1;
  16. static int sound_search2;
  17. static int tread_sound;
  18. void BossExplode (edict_t *self);
  19. void TreadSound (edict_t *self)
  20. {
  21. gi.sound (self, CHAN_VOICE, tread_sound, 1, ATTN_NORM, 0);
  22. }
  23. void supertank_search (edict_t *self)
  24. {
  25. if (random() < 0.5)
  26. gi.sound (self, CHAN_VOICE, sound_search1, 1, ATTN_NORM, 0);
  27. else
  28. gi.sound (self, CHAN_VOICE, sound_search2, 1, ATTN_NORM, 0);
  29. }
  30. void supertank_dead (edict_t *self);
  31. void supertankRocket (edict_t *self);
  32. void supertankMachineGun (edict_t *self);
  33. void supertank_reattack1(edict_t *self);
  34. //
  35. // stand
  36. //
  37. mframe_t supertank_frames_stand []=
  38. {
  39. ai_stand, 0, NULL,
  40. ai_stand, 0, NULL,
  41. ai_stand, 0, NULL,
  42. ai_stand, 0, NULL,
  43. ai_stand, 0, NULL,
  44. ai_stand, 0, NULL,
  45. ai_stand, 0, NULL,
  46. ai_stand, 0, NULL,
  47. ai_stand, 0, NULL,
  48. ai_stand, 0, NULL,
  49. ai_stand, 0, NULL,
  50. ai_stand, 0, NULL,
  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. };
  100. mmove_t supertank_move_stand = {FRAME_stand_1, FRAME_stand_60, supertank_frames_stand, NULL};
  101. void supertank_stand (edict_t *self)
  102. {
  103. self->monsterinfo.currentmove = &supertank_move_stand;
  104. }
  105. mframe_t supertank_frames_run [] =
  106. {
  107. ai_run, 12, TreadSound,
  108. ai_run, 12, NULL,
  109. ai_run, 12, NULL,
  110. ai_run, 12, NULL,
  111. ai_run, 12, NULL,
  112. ai_run, 12, NULL,
  113. ai_run, 12, NULL,
  114. ai_run, 12, NULL,
  115. ai_run, 12, NULL,
  116. ai_run, 12, NULL,
  117. ai_run, 12, NULL,
  118. ai_run, 12, NULL,
  119. ai_run, 12, NULL,
  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. };
  126. mmove_t supertank_move_run = {FRAME_forwrd_1, FRAME_forwrd_18, supertank_frames_run, NULL};
  127. //
  128. // walk
  129. //
  130. mframe_t supertank_frames_forward [] =
  131. {
  132. ai_walk, 4, TreadSound,
  133. ai_walk, 4, NULL,
  134. ai_walk, 4, NULL,
  135. ai_walk, 4, NULL,
  136. ai_walk, 4, NULL,
  137. ai_walk, 4, NULL,
  138. ai_walk, 4, NULL,
  139. ai_walk, 4, NULL,
  140. ai_walk, 4, NULL,
  141. ai_walk, 4, NULL,
  142. ai_walk, 4, NULL,
  143. ai_walk, 4, NULL,
  144. ai_walk, 4, NULL,
  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. };
  151. mmove_t supertank_move_forward = {FRAME_forwrd_1, FRAME_forwrd_18, supertank_frames_forward, NULL};
  152. void supertank_forward (edict_t *self)
  153. {
  154. self->monsterinfo.currentmove = &supertank_move_forward;
  155. }
  156. void supertank_walk (edict_t *self)
  157. {
  158. self->monsterinfo.currentmove = &supertank_move_forward;
  159. }
  160. void supertank_run (edict_t *self)
  161. {
  162. if (self->monsterinfo.aiflags & AI_STAND_GROUND)
  163. self->monsterinfo.currentmove = &supertank_move_stand;
  164. else
  165. self->monsterinfo.currentmove = &supertank_move_run;
  166. }
  167. mframe_t supertank_frames_turn_right [] =
  168. {
  169. ai_move, 0, TreadSound,
  170. ai_move, 0, NULL,
  171. ai_move, 0, NULL,
  172. ai_move, 0, NULL,
  173. ai_move, 0, NULL,
  174. ai_move, 0, NULL,
  175. ai_move, 0, NULL,
  176. ai_move, 0, NULL,
  177. ai_move, 0, NULL,
  178. ai_move, 0, NULL,
  179. ai_move, 0, NULL,
  180. ai_move, 0, NULL,
  181. ai_move, 0, NULL,
  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. };
  188. mmove_t supertank_move_turn_right = {FRAME_right_1, FRAME_right_18, supertank_frames_turn_right, supertank_run};
  189. mframe_t supertank_frames_turn_left [] =
  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_left = {FRAME_left_1, FRAME_left_18, supertank_frames_turn_left, supertank_run};
  211. mframe_t supertank_frames_pain3 [] =
  212. {
  213. ai_move, 0, NULL,
  214. ai_move, 0, NULL,
  215. ai_move, 0, NULL,
  216. ai_move, 0, NULL
  217. };
  218. mmove_t supertank_move_pain3 = {FRAME_pain3_9, FRAME_pain3_12, supertank_frames_pain3, supertank_run};
  219. mframe_t supertank_frames_pain2 [] =
  220. {
  221. ai_move, 0, NULL,
  222. ai_move, 0, NULL,
  223. ai_move, 0, NULL,
  224. ai_move, 0, NULL
  225. };
  226. mmove_t supertank_move_pain2 = {FRAME_pain2_5, FRAME_pain2_8, supertank_frames_pain2, supertank_run};
  227. mframe_t supertank_frames_pain1 [] =
  228. {
  229. ai_move, 0, NULL,
  230. ai_move, 0, NULL,
  231. ai_move, 0, NULL,
  232. ai_move, 0, NULL
  233. };
  234. mmove_t supertank_move_pain1 = {FRAME_pain1_1, FRAME_pain1_4, supertank_frames_pain1, supertank_run};
  235. mframe_t supertank_frames_death1 [] =
  236. {
  237. ai_move, 0, NULL,
  238. ai_move, 0, NULL,
  239. ai_move, 0, NULL,
  240. ai_move, 0, NULL,
  241. ai_move, 0, NULL,
  242. ai_move, 0, NULL,
  243. ai_move, 0, NULL,
  244. ai_move, 0, NULL,
  245. ai_move, 0, NULL,
  246. ai_move, 0, NULL,
  247. ai_move, 0, NULL,
  248. ai_move, 0, NULL,
  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, BossExplode
  261. };
  262. mmove_t supertank_move_death = {FRAME_death_1, FRAME_death_24, supertank_frames_death1, supertank_dead};
  263. mframe_t supertank_frames_backward[] =
  264. {
  265. ai_walk, 0, TreadSound,
  266. ai_walk, 0, NULL,
  267. ai_walk, 0, NULL,
  268. ai_walk, 0, NULL,
  269. ai_walk, 0, NULL,
  270. ai_walk, 0, NULL,
  271. ai_walk, 0, NULL,
  272. ai_walk, 0, NULL,
  273. ai_walk, 0, NULL,
  274. ai_walk, 0, NULL,
  275. ai_walk, 0, NULL,
  276. ai_walk, 0, NULL,
  277. ai_walk, 0, NULL,
  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. };
  284. mmove_t supertank_move_backward = {FRAME_backwd_1, FRAME_backwd_18, supertank_frames_backward, NULL};
  285. mframe_t supertank_frames_attack4[]=
  286. {
  287. ai_move, 0, NULL,
  288. ai_move, 0, NULL,
  289. ai_move, 0, NULL,
  290. ai_move, 0, NULL,
  291. ai_move, 0, NULL,
  292. ai_move, 0, NULL
  293. };
  294. mmove_t supertank_move_attack4 = {FRAME_attak4_1, FRAME_attak4_6, supertank_frames_attack4, supertank_run};
  295. mframe_t supertank_frames_attack3[]=
  296. {
  297. ai_move, 0, NULL,
  298. ai_move, 0, NULL,
  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. ai_move, 0, NULL,
  306. ai_move, 0, NULL,
  307. ai_move, 0, NULL,
  308. ai_move, 0, NULL,
  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. };
  325. mmove_t supertank_move_attack3 = {FRAME_attak3_1, FRAME_attak3_27, supertank_frames_attack3, supertank_run};
  326. mframe_t supertank_frames_attack2[]=
  327. {
  328. ai_charge, 0, NULL,
  329. ai_charge, 0, NULL,
  330. ai_charge, 0, NULL,
  331. ai_charge, 0, NULL,
  332. ai_charge, 0, NULL,
  333. ai_charge, 0, NULL,
  334. ai_charge, 0, NULL,
  335. ai_charge, 0, supertankRocket,
  336. ai_move, 0, NULL,
  337. ai_move, 0, NULL,
  338. ai_move, 0, supertankRocket,
  339. ai_move, 0, NULL,
  340. ai_move, 0, NULL,
  341. ai_move, 0, supertankRocket,
  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_attack2 = {FRAME_attak2_1, FRAME_attak2_27, supertank_frames_attack2, supertank_run};
  357. mframe_t supertank_frames_attack1[]=
  358. {
  359. ai_charge, 0, supertankMachineGun,
  360. ai_charge, 0, supertankMachineGun,
  361. ai_charge, 0, supertankMachineGun,
  362. ai_charge, 0, supertankMachineGun,
  363. ai_charge, 0, supertankMachineGun,
  364. ai_charge, 0, supertankMachineGun,
  365. };
  366. mmove_t supertank_move_attack1 = {FRAME_attak1_1, FRAME_attak1_6, supertank_frames_attack1, supertank_reattack1};
  367. mframe_t supertank_frames_end_attack1[]=
  368. {
  369. ai_move, 0, NULL,
  370. ai_move, 0, NULL,
  371. ai_move, 0, NULL,
  372. ai_move, 0, NULL,
  373. ai_move, 0, NULL,
  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. };
  384. mmove_t supertank_move_end_attack1 = {FRAME_attak1_7, FRAME_attak1_20, supertank_frames_end_attack1, supertank_run};
  385. void supertank_reattack1(edict_t *self)
  386. {
  387. if (visible(self, self->enemy))
  388. if (random() < 0.9)
  389. self->monsterinfo.currentmove = &supertank_move_attack1;
  390. else
  391. self->monsterinfo.currentmove = &supertank_move_end_attack1;
  392. else
  393. self->monsterinfo.currentmove = &supertank_move_end_attack1;
  394. }
  395. void supertank_pain (edict_t *self, edict_t *other, float kick, int damage)
  396. {
  397. if (self->health < (self->max_health / 2))
  398. self->s.skinnum = 1;
  399. if (level.time < self->pain_debounce_time)
  400. return;
  401. // Lessen the chance of him going into his pain frames
  402. if (damage <=25)
  403. if (random()<0.2)
  404. return;
  405. // Don't go into pain if he's firing his rockets
  406. if (skill->value >= 2)
  407. if ( (self->s.frame >= FRAME_attak2_1) && (self->s.frame <= FRAME_attak2_14) )
  408. return;
  409. self->pain_debounce_time = level.time + 3;
  410. if (skill->value == 3)
  411. return; // no pain anims in nightmare
  412. if (damage <= 10)
  413. {
  414. gi.sound (self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM,0);
  415. self->monsterinfo.currentmove = &supertank_move_pain1;
  416. }
  417. else if (damage <= 25)
  418. {
  419. gi.sound (self, CHAN_VOICE, sound_pain3, 1, ATTN_NORM,0);
  420. self->monsterinfo.currentmove = &supertank_move_pain2;
  421. }
  422. else
  423. {
  424. gi.sound (self, CHAN_VOICE, sound_pain2, 1, ATTN_NORM,0);
  425. self->monsterinfo.currentmove = &supertank_move_pain3;
  426. }
  427. };
  428. void supertankRocket (edict_t *self)
  429. {
  430. vec3_t forward, right;
  431. vec3_t start;
  432. vec3_t dir;
  433. vec3_t vec;
  434. int flash_number;
  435. if(!self->enemy || !self->enemy->inuse) //PGM
  436. return; //PGM
  437. if (self->s.frame == FRAME_attak2_8)
  438. flash_number = MZ2_SUPERTANK_ROCKET_1;
  439. else if (self->s.frame == FRAME_attak2_11)
  440. flash_number = MZ2_SUPERTANK_ROCKET_2;
  441. else // (self->s.frame == FRAME_attak2_14)
  442. flash_number = MZ2_SUPERTANK_ROCKET_3;
  443. AngleVectors (self->s.angles, forward, right, NULL);
  444. G_ProjectSource (self->s.origin, monster_flash_offset[flash_number], forward, right, start);
  445. VectorCopy (self->enemy->s.origin, vec);
  446. vec[2] += self->enemy->viewheight;
  447. VectorSubtract (vec, start, dir);
  448. VectorNormalize (dir);
  449. monster_fire_rocket (self, start, dir, 50, 500, flash_number);
  450. }
  451. void supertankMachineGun (edict_t *self)
  452. {
  453. vec3_t dir;
  454. vec3_t vec;
  455. vec3_t start;
  456. vec3_t forward, right;
  457. int flash_number;
  458. if(!self->enemy || !self->enemy->inuse) //PGM
  459. return; //PGM
  460. flash_number = MZ2_SUPERTANK_MACHINEGUN_1 + (self->s.frame - FRAME_attak1_1);
  461. //FIXME!!!
  462. dir[0] = 0;
  463. dir[1] = self->s.angles[1];
  464. dir[2] = 0;
  465. AngleVectors (dir, forward, right, NULL);
  466. G_ProjectSource (self->s.origin, monster_flash_offset[flash_number], forward, right, start);
  467. if (self->enemy)
  468. {
  469. VectorCopy (self->enemy->s.origin, vec);
  470. VectorMA (vec, 0, self->enemy->velocity, vec);
  471. vec[2] += self->enemy->viewheight;
  472. VectorSubtract (vec, start, forward);
  473. VectorNormalize (forward);
  474. }
  475. monster_fire_bullet (self, start, forward, 6, 4, DEFAULT_BULLET_HSPREAD, DEFAULT_BULLET_VSPREAD, flash_number);
  476. }
  477. void supertank_attack(edict_t *self)
  478. {
  479. vec3_t vec;
  480. float range;
  481. //float r;
  482. VectorSubtract (self->enemy->s.origin, self->s.origin, vec);
  483. range = VectorLength (vec);
  484. //r = random();
  485. // Attack 1 == Chaingun
  486. // Attack 2 == Rocket Launcher
  487. if (range <= 160)
  488. {
  489. self->monsterinfo.currentmove = &supertank_move_attack1;
  490. }
  491. else
  492. { // fire rockets more often at distance
  493. if (random() < 0.3)
  494. self->monsterinfo.currentmove = &supertank_move_attack1;
  495. else
  496. self->monsterinfo.currentmove = &supertank_move_attack2;
  497. }
  498. }
  499. //
  500. // death
  501. //
  502. void supertank_dead (edict_t *self)
  503. {
  504. VectorSet (self->mins, -60, -60, 0);
  505. VectorSet (self->maxs, 60, 60, 72);
  506. self->movetype = MOVETYPE_TOSS;
  507. self->svflags |= SVF_DEADMONSTER;
  508. self->nextthink = 0;
  509. gi.linkentity (self);
  510. }
  511. void BossExplode (edict_t *self)
  512. {
  513. vec3_t org;
  514. int n;
  515. self->think = BossExplode;
  516. VectorCopy (self->s.origin, org);
  517. org[2] += 24 + (rand()&15);
  518. switch (self->count++)
  519. {
  520. case 0:
  521. org[0] -= 24;
  522. org[1] -= 24;
  523. break;
  524. case 1:
  525. org[0] += 24;
  526. org[1] += 24;
  527. break;
  528. case 2:
  529. org[0] += 24;
  530. org[1] -= 24;
  531. break;
  532. case 3:
  533. org[0] -= 24;
  534. org[1] += 24;
  535. break;
  536. case 4:
  537. org[0] -= 48;
  538. org[1] -= 48;
  539. break;
  540. case 5:
  541. org[0] += 48;
  542. org[1] += 48;
  543. break;
  544. case 6:
  545. org[0] -= 48;
  546. org[1] += 48;
  547. break;
  548. case 7:
  549. org[0] += 48;
  550. org[1] -= 48;
  551. break;
  552. case 8:
  553. self->s.sound = 0;
  554. for (n= 0; n < 4; n++)
  555. ThrowGib (self, "models/objects/gibs/sm_meat/tris.md2", 500, GIB_ORGANIC);
  556. for (n= 0; n < 8; n++)
  557. ThrowGib (self, "models/objects/gibs/sm_metal/tris.md2", 500, GIB_METALLIC);
  558. ThrowGib (self, "models/objects/gibs/chest/tris.md2", 500, GIB_ORGANIC);
  559. ThrowHead (self, "models/objects/gibs/gear/tris.md2", 500, GIB_METALLIC);
  560. self->deadflag = DEAD_DEAD;
  561. return;
  562. }
  563. gi.WriteByte (svc_temp_entity);
  564. gi.WriteByte (TE_EXPLOSION1);
  565. gi.WritePosition (org);
  566. gi.multicast (self->s.origin, MULTICAST_PVS);
  567. self->nextthink = level.time + 0.1;
  568. }
  569. void supertank_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point)
  570. {
  571. gi.sound (self, CHAN_VOICE, sound_death, 1, ATTN_NORM, 0);
  572. self->deadflag = DEAD_DEAD;
  573. self->takedamage = DAMAGE_NO;
  574. self->count = 0;
  575. self->monsterinfo.currentmove = &supertank_move_death;
  576. }
  577. //===========
  578. //PGM
  579. qboolean supertank_blocked (edict_t *self, float dist)
  580. {
  581. if(blocked_checkshot (self, 0.25 + (0.05 * skill->value) ))
  582. return true;
  583. if(blocked_checkplat (self, dist))
  584. return true;
  585. return false;
  586. }
  587. //PGM
  588. //===========
  589. //
  590. // monster_supertank
  591. //
  592. /*QUAKED monster_supertank (1 .5 0) (-64 -64 0) (64 64 72) Ambush Trigger_Spawn Sight
  593. */
  594. void SP_monster_supertank (edict_t *self)
  595. {
  596. if (deathmatch->value)
  597. {
  598. G_FreeEdict (self);
  599. return;
  600. }
  601. sound_pain1 = gi.soundindex ("bosstank/btkpain1.wav");
  602. sound_pain2 = gi.soundindex ("bosstank/btkpain2.wav");
  603. sound_pain3 = gi.soundindex ("bosstank/btkpain3.wav");
  604. sound_death = gi.soundindex ("bosstank/btkdeth1.wav");
  605. sound_search1 = gi.soundindex ("bosstank/btkunqv1.wav");
  606. sound_search2 = gi.soundindex ("bosstank/btkunqv2.wav");
  607. // self->s.sound = gi.soundindex ("bosstank/btkengn1.wav");
  608. tread_sound = gi.soundindex ("bosstank/btkengn1.wav");
  609. self->movetype = MOVETYPE_STEP;
  610. self->solid = SOLID_BBOX;
  611. self->s.modelindex = gi.modelindex ("models/monsters/boss1/tris.md2");
  612. VectorSet (self->mins, -64, -64, 0);
  613. VectorSet (self->maxs, 64, 64, 112);
  614. self->health = 1500;
  615. self->gib_health = -500;
  616. self->mass = 800;
  617. self->pain = supertank_pain;
  618. self->die = supertank_die;
  619. self->monsterinfo.stand = supertank_stand;
  620. self->monsterinfo.walk = supertank_walk;
  621. self->monsterinfo.run = supertank_run;
  622. self->monsterinfo.dodge = NULL;
  623. self->monsterinfo.attack = supertank_attack;
  624. self->monsterinfo.search = supertank_search;
  625. self->monsterinfo.melee = NULL;
  626. self->monsterinfo.sight = NULL;
  627. self->monsterinfo.blocked = supertank_blocked; //PGM
  628. gi.linkentity (self);
  629. self->monsterinfo.currentmove = &supertank_move_stand;
  630. self->monsterinfo.scale = MODEL_SCALE;
  631. walkmonster_start(self);
  632. //PMM
  633. self->monsterinfo.aiflags |= AI_IGNORE_SHOTS;
  634. //pmm
  635. }