m_boss2.cpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686
  1. // Copyright (c) ZeniMax Media Inc.
  2. // Licensed under the GNU General Public License 2.0.
  3. /*
  4. ==============================================================================
  5. boss2
  6. ==============================================================================
  7. */
  8. #include "g_local.h"
  9. #include "m_boss2.h"
  10. #include "m_flash.h"
  11. // [Paril-KEX]
  12. constexpr spawnflags_t SPAWNFLAG_BOSS2_N64 = 8_spawnflag;
  13. bool infront(edict_t *self, edict_t *other);
  14. static cached_soundindex sound_pain1;
  15. static cached_soundindex sound_pain2;
  16. static cached_soundindex sound_pain3;
  17. static cached_soundindex sound_death;
  18. static cached_soundindex sound_search1;
  19. MONSTERINFO_SEARCH(boss2_search) (edict_t *self) -> void
  20. {
  21. if (frandom() < 0.5f)
  22. gi.sound(self, CHAN_VOICE, sound_search1, 1, ATTN_NONE, 0);
  23. }
  24. void boss2_run(edict_t *self);
  25. void boss2_dead(edict_t *self);
  26. void boss2_attack_mg(edict_t *self);
  27. void boss2_reattack_mg(edict_t *self);
  28. constexpr int32_t BOSS2_ROCKET_SPEED = 750;
  29. void Boss2PredictiveRocket(edict_t *self)
  30. {
  31. vec3_t forward, right;
  32. vec3_t start;
  33. vec3_t dir;
  34. AngleVectors(self->s.angles, forward, right, nullptr);
  35. // 1
  36. start = M_ProjectFlashSource(self, monster_flash_offset[MZ2_BOSS2_ROCKET_1], forward, right);
  37. PredictAim(self, self->enemy, start, BOSS2_ROCKET_SPEED, false, -0.10f, &dir, nullptr);
  38. monster_fire_rocket(self, start, dir, 50, BOSS2_ROCKET_SPEED, MZ2_BOSS2_ROCKET_1);
  39. // 2
  40. start = M_ProjectFlashSource(self, monster_flash_offset[MZ2_BOSS2_ROCKET_2], forward, right);
  41. PredictAim(self, self->enemy, start, BOSS2_ROCKET_SPEED, false, -0.05f, &dir, nullptr);
  42. monster_fire_rocket(self, start, dir, 50, BOSS2_ROCKET_SPEED, MZ2_BOSS2_ROCKET_2);
  43. // 3
  44. start = M_ProjectFlashSource(self, monster_flash_offset[MZ2_BOSS2_ROCKET_3], forward, right);
  45. PredictAim(self, self->enemy, start, BOSS2_ROCKET_SPEED, false, 0.05f, &dir, nullptr);
  46. monster_fire_rocket(self, start, dir, 50, BOSS2_ROCKET_SPEED, MZ2_BOSS2_ROCKET_3);
  47. // 4
  48. start = M_ProjectFlashSource(self, monster_flash_offset[MZ2_BOSS2_ROCKET_4], forward, right);
  49. PredictAim(self, self->enemy, start, BOSS2_ROCKET_SPEED, false, 0.10f, &dir, nullptr);
  50. monster_fire_rocket(self, start, dir, 50, BOSS2_ROCKET_SPEED, MZ2_BOSS2_ROCKET_4);
  51. }
  52. void Boss2Rocket(edict_t *self)
  53. {
  54. vec3_t forward, right;
  55. vec3_t start;
  56. vec3_t dir;
  57. vec3_t vec;
  58. if (self->enemy)
  59. {
  60. if (self->enemy->client && frandom() < 0.9f)
  61. {
  62. Boss2PredictiveRocket(self);
  63. return;
  64. }
  65. }
  66. AngleVectors(self->s.angles, forward, right, nullptr);
  67. // 1
  68. start = M_ProjectFlashSource(self, monster_flash_offset[MZ2_BOSS2_ROCKET_1], forward, right);
  69. vec = self->enemy->s.origin;
  70. vec[2] -= 15;
  71. dir = vec - start;
  72. dir.normalize();
  73. dir += (right * 0.4f);
  74. dir.normalize();
  75. monster_fire_rocket(self, start, dir, 50, 500, MZ2_BOSS2_ROCKET_1);
  76. // 2
  77. start = M_ProjectFlashSource(self, monster_flash_offset[MZ2_BOSS2_ROCKET_2], forward, right);
  78. vec = self->enemy->s.origin;
  79. dir = vec - start;
  80. dir.normalize();
  81. dir += (right * 0.025f);
  82. dir.normalize();
  83. monster_fire_rocket(self, start, dir, 50, 500, MZ2_BOSS2_ROCKET_2);
  84. // 3
  85. start = M_ProjectFlashSource(self, monster_flash_offset[MZ2_BOSS2_ROCKET_3], forward, right);
  86. vec = self->enemy->s.origin;
  87. dir = vec - start;
  88. dir.normalize();
  89. dir += (right * -0.025f);
  90. dir.normalize();
  91. monster_fire_rocket(self, start, dir, 50, 500, MZ2_BOSS2_ROCKET_3);
  92. // 4
  93. start = M_ProjectFlashSource(self, monster_flash_offset[MZ2_BOSS2_ROCKET_4], forward, right);
  94. vec = self->enemy->s.origin;
  95. vec[2] -= 15;
  96. dir = vec - start;
  97. dir.normalize();
  98. dir += (right * -0.4f);
  99. dir.normalize();
  100. monster_fire_rocket(self, start, dir, 50, 500, MZ2_BOSS2_ROCKET_4);
  101. }
  102. void Boss2Rocket64(edict_t *self)
  103. {
  104. vec3_t forward, right;
  105. vec3_t start;
  106. vec3_t dir;
  107. vec3_t vec;
  108. float time, dist;
  109. AngleVectors(self->s.angles, forward, right, nullptr);
  110. start = M_ProjectFlashSource(self, monster_flash_offset[MZ2_BOSS2_ROCKET_1], forward, right);
  111. float scale = self->s.scale ? self->s.scale : 1;
  112. start[2] += 10.f * scale;
  113. start -= right * 2.f * scale;
  114. start -= right * ((self->count++ % 4) * 8.f * scale);
  115. if (self->enemy && self->enemy->client && frandom() < 0.9f)
  116. {
  117. // 1
  118. dir = self->enemy->s.origin - start;
  119. dist = dir.length();
  120. time = dist / BOSS2_ROCKET_SPEED;
  121. vec = self->enemy->s.origin + (self->enemy->velocity * (time - 0.3f));
  122. }
  123. else
  124. {
  125. // 1
  126. vec = self->enemy->s.origin;
  127. vec[2] -= 15;
  128. }
  129. dir = vec - start;
  130. dir.normalize();
  131. monster_fire_rocket(self, start, dir, 35, BOSS2_ROCKET_SPEED, MZ2_BOSS2_ROCKET_1);
  132. }
  133. void boss2_firebullet_right(edict_t *self)
  134. {
  135. vec3_t forward, right, start;
  136. AngleVectors(self->s.angles, forward, right, nullptr);
  137. start = M_ProjectFlashSource(self, monster_flash_offset[MZ2_BOSS2_MACHINEGUN_R1], forward, right);
  138. PredictAim(self, self->enemy, start, 0, true, -0.2f, &forward, nullptr);
  139. monster_fire_bullet(self, start, forward, 6, 4, DEFAULT_BULLET_HSPREAD * 3, DEFAULT_BULLET_VSPREAD, MZ2_BOSS2_MACHINEGUN_R1);
  140. }
  141. void boss2_firebullet_left(edict_t *self)
  142. {
  143. vec3_t forward, right, start;
  144. AngleVectors(self->s.angles, forward, right, nullptr);
  145. start = M_ProjectFlashSource(self, monster_flash_offset[MZ2_BOSS2_MACHINEGUN_L1], forward, right);
  146. PredictAim(self, self->enemy, start, 0, true, -0.2f, &forward, nullptr);
  147. monster_fire_bullet(self, start, forward, 6, 4, DEFAULT_BULLET_HSPREAD * 3, DEFAULT_BULLET_VSPREAD, MZ2_BOSS2_MACHINEGUN_L1);
  148. }
  149. void Boss2MachineGun(edict_t *self)
  150. {
  151. boss2_firebullet_left(self);
  152. boss2_firebullet_right(self);
  153. }
  154. mframe_t boss2_frames_stand[] = {
  155. { ai_stand },
  156. { ai_stand },
  157. { ai_stand },
  158. { ai_stand },
  159. { ai_stand },
  160. { ai_stand },
  161. { ai_stand },
  162. { ai_stand },
  163. { ai_stand },
  164. { ai_stand },
  165. { ai_stand },
  166. { ai_stand },
  167. { ai_stand },
  168. { ai_stand },
  169. { ai_stand },
  170. { ai_stand },
  171. { ai_stand },
  172. { ai_stand },
  173. { ai_stand },
  174. { ai_stand },
  175. { ai_stand }
  176. };
  177. MMOVE_T(boss2_move_stand) = { FRAME_stand30, FRAME_stand50, boss2_frames_stand, nullptr };
  178. mframe_t boss2_frames_walk[] = {
  179. { ai_walk, 10 },
  180. { ai_walk, 10 },
  181. { ai_walk, 10 },
  182. { ai_walk, 10 },
  183. { ai_walk, 10 },
  184. { ai_walk, 10 },
  185. { ai_walk, 10 },
  186. { ai_walk, 10 },
  187. { ai_walk, 10 },
  188. { ai_walk, 10 },
  189. { ai_walk, 10 },
  190. { ai_walk, 10 },
  191. { ai_walk, 10 },
  192. { ai_walk, 10 },
  193. { ai_walk, 10 },
  194. { ai_walk, 10 },
  195. { ai_walk, 10 },
  196. { ai_walk, 10 },
  197. { ai_walk, 10 },
  198. { ai_walk, 10 }
  199. };
  200. MMOVE_T(boss2_move_walk) = { FRAME_walk1, FRAME_walk20, boss2_frames_walk, nullptr };
  201. mframe_t boss2_frames_run[] = {
  202. { ai_run, 10 },
  203. { ai_run, 10 },
  204. { ai_run, 10 },
  205. { ai_run, 10 },
  206. { ai_run, 10 },
  207. { ai_run, 10 },
  208. { ai_run, 10 },
  209. { ai_run, 10 },
  210. { ai_run, 10 },
  211. { ai_run, 10 },
  212. { ai_run, 10 },
  213. { ai_run, 10 },
  214. { ai_run, 10 },
  215. { ai_run, 10 },
  216. { ai_run, 10 },
  217. { ai_run, 10 },
  218. { ai_run, 10 },
  219. { ai_run, 10 },
  220. { ai_run, 10 },
  221. { ai_run, 10 }
  222. };
  223. MMOVE_T(boss2_move_run) = { FRAME_walk1, FRAME_walk20, boss2_frames_run, nullptr };
  224. mframe_t boss2_frames_attack_pre_mg[] = {
  225. { ai_charge, 2 },
  226. { ai_charge, 2 },
  227. { ai_charge, 2 },
  228. { ai_charge, 2 },
  229. { ai_charge, 2 },
  230. { ai_charge, 2 },
  231. { ai_charge, 2 },
  232. { ai_charge, 2 },
  233. { ai_charge, 2, boss2_attack_mg }
  234. };
  235. MMOVE_T(boss2_move_attack_pre_mg) = { FRAME_attack1, FRAME_attack9, boss2_frames_attack_pre_mg, nullptr };
  236. // Loop this
  237. mframe_t boss2_frames_attack_mg[] = {
  238. { ai_charge, 2, Boss2MachineGun },
  239. { ai_charge, 2, Boss2MachineGun },
  240. { ai_charge, 2, Boss2MachineGun },
  241. { ai_charge, 2, Boss2MachineGun },
  242. { ai_charge, 2, Boss2MachineGun },
  243. { ai_charge, 2, boss2_reattack_mg }
  244. };
  245. MMOVE_T(boss2_move_attack_mg) = { FRAME_attack10, FRAME_attack15, boss2_frames_attack_mg, nullptr };
  246. // [Paril-KEX]
  247. void Boss2HyperBlaster(edict_t *self)
  248. {
  249. vec3_t forward, right, target;
  250. vec3_t start;
  251. monster_muzzleflash_id_t id = (self->s.frame & 1) ? MZ2_BOSS2_MACHINEGUN_L2 : MZ2_BOSS2_MACHINEGUN_R2;
  252. AngleVectors(self->s.angles, forward, right, nullptr);
  253. start = M_ProjectFlashSource(self, monster_flash_offset[id], forward, right);
  254. target = self->enemy->s.origin;
  255. target[2] += self->enemy->viewheight;
  256. forward = target - start;
  257. forward.normalize();
  258. monster_fire_blaster(self, start, forward, 2, 1000, id, (self->s.frame % 4) ? EF_NONE : EF_HYPERBLASTER);
  259. }
  260. mframe_t boss2_frames_attack_hb[] = {
  261. { ai_charge, 2, Boss2HyperBlaster },
  262. { ai_charge, 2, Boss2HyperBlaster },
  263. { ai_charge, 2, Boss2HyperBlaster },
  264. { ai_charge, 2, Boss2HyperBlaster },
  265. { ai_charge, 2, Boss2HyperBlaster },
  266. { ai_charge, 2, [](edict_t *self) -> void { Boss2HyperBlaster(self); boss2_reattack_mg(self); } }
  267. };
  268. MMOVE_T(boss2_move_attack_hb) = { FRAME_attack10, FRAME_attack15, boss2_frames_attack_hb, nullptr };
  269. mframe_t boss2_frames_attack_post_mg[] = {
  270. { ai_charge, 2 },
  271. { ai_charge, 2 },
  272. { ai_charge, 2 },
  273. { ai_charge, 2 }
  274. };
  275. MMOVE_T(boss2_move_attack_post_mg) = { FRAME_attack16, FRAME_attack19, boss2_frames_attack_post_mg, boss2_run };
  276. mframe_t boss2_frames_attack_rocket[] = {
  277. { ai_charge, 2 },
  278. { ai_charge, 2 },
  279. { ai_charge, 2 },
  280. { ai_charge, 2 },
  281. { ai_charge, 2 },
  282. { ai_charge, 2 },
  283. { ai_charge, 2 },
  284. { ai_charge, 2 },
  285. { ai_charge, 2 },
  286. { ai_charge, 2 },
  287. { ai_charge, 2 },
  288. { ai_charge, 2 },
  289. { ai_move, -5, Boss2Rocket },
  290. { ai_charge, 2 },
  291. { ai_charge, 2 },
  292. { ai_charge, 2 },
  293. { ai_charge, 2 },
  294. { ai_charge, 2 },
  295. { ai_charge, 2 },
  296. { ai_charge, 2 },
  297. { ai_charge, 2 }
  298. };
  299. MMOVE_T(boss2_move_attack_rocket) = { FRAME_attack20, FRAME_attack40, boss2_frames_attack_rocket, boss2_run };
  300. // [Paril-KEX] n64 rocket behavior
  301. mframe_t boss2_frames_attack_rocket2[] = {
  302. { ai_charge, 2, Boss2Rocket64 },
  303. { ai_charge, 2 },
  304. { ai_charge, 2 },
  305. { ai_charge, 2 },
  306. { ai_charge, 2, Boss2Rocket64 },
  307. { ai_charge, 2 },
  308. { ai_charge, 2 },
  309. { ai_charge, 2 },
  310. { ai_charge, 2, Boss2Rocket64 },
  311. { ai_charge, 2 },
  312. { ai_charge, 2 },
  313. { ai_charge, 2 },
  314. { ai_charge, 2, Boss2Rocket64 },
  315. { ai_charge, 2 },
  316. { ai_charge, 2 },
  317. { ai_charge, 2 },
  318. { ai_charge, 2, Boss2Rocket64 },
  319. { ai_charge, 2 },
  320. { ai_charge, 2 },
  321. { ai_charge, 2 }
  322. };
  323. MMOVE_T(boss2_move_attack_rocket2) = { FRAME_attack20, FRAME_attack39, boss2_frames_attack_rocket2, boss2_run };
  324. mframe_t boss2_frames_pain_heavy[] = {
  325. { ai_move },
  326. { ai_move },
  327. { ai_move },
  328. { ai_move },
  329. { ai_move },
  330. { ai_move },
  331. { ai_move },
  332. { ai_move },
  333. { ai_move },
  334. { ai_move },
  335. { ai_move },
  336. { ai_move },
  337. { ai_move },
  338. { ai_move },
  339. { ai_move },
  340. { ai_move },
  341. { ai_move },
  342. { ai_move }
  343. };
  344. MMOVE_T(boss2_move_pain_heavy) = { FRAME_pain2, FRAME_pain19, boss2_frames_pain_heavy, boss2_run };
  345. mframe_t boss2_frames_pain_light[] = {
  346. { ai_move },
  347. { ai_move },
  348. { ai_move },
  349. { ai_move }
  350. };
  351. MMOVE_T(boss2_move_pain_light) = { FRAME_pain20, FRAME_pain23, boss2_frames_pain_light, boss2_run };
  352. static void boss2_shrink(edict_t *self)
  353. {
  354. self->maxs.z = 50.f;
  355. gi.linkentity(self);
  356. }
  357. mframe_t boss2_frames_death[] = {
  358. { ai_move, 0, BossExplode },
  359. { ai_move },
  360. { ai_move },
  361. { ai_move },
  362. { ai_move },
  363. { ai_move },
  364. { ai_move },
  365. { ai_move },
  366. { ai_move },
  367. { ai_move },
  368. { ai_move },
  369. { ai_move },
  370. { ai_move },
  371. { ai_move },
  372. { ai_move },
  373. { ai_move },
  374. { ai_move },
  375. { ai_move },
  376. { ai_move },
  377. { ai_move },
  378. { ai_move },
  379. { ai_move },
  380. { ai_move },
  381. { ai_move },
  382. { ai_move },
  383. { ai_move },
  384. { ai_move },
  385. { ai_move },
  386. { ai_move },
  387. { ai_move },
  388. { ai_move },
  389. { ai_move, 0, boss2_shrink },
  390. { ai_move },
  391. { ai_move },
  392. { ai_move },
  393. { ai_move },
  394. { ai_move },
  395. { ai_move },
  396. { ai_move },
  397. { ai_move },
  398. { ai_move },
  399. { ai_move },
  400. { ai_move },
  401. { ai_move },
  402. { ai_move },
  403. { ai_move },
  404. { ai_move },
  405. { ai_move },
  406. { ai_move }
  407. };
  408. MMOVE_T(boss2_move_death) = { FRAME_death2, FRAME_death50, boss2_frames_death, boss2_dead };
  409. MONSTERINFO_STAND(boss2_stand) (edict_t *self) -> void
  410. {
  411. M_SetAnimation(self, &boss2_move_stand);
  412. }
  413. MONSTERINFO_RUN(boss2_run) (edict_t *self) -> void
  414. {
  415. if (self->monsterinfo.aiflags & AI_STAND_GROUND)
  416. M_SetAnimation(self, &boss2_move_stand);
  417. else
  418. M_SetAnimation(self, &boss2_move_run);
  419. }
  420. MONSTERINFO_WALK(boss2_walk) (edict_t *self) -> void
  421. {
  422. M_SetAnimation(self, &boss2_move_walk);
  423. }
  424. MONSTERINFO_ATTACK(boss2_attack) (edict_t *self) -> void
  425. {
  426. vec3_t vec;
  427. float range;
  428. vec = self->enemy->s.origin - self->s.origin;
  429. range = vec.length();
  430. if (range <= 125 || frandom() <= 0.6f)
  431. M_SetAnimation(self, self->spawnflags.has(SPAWNFLAG_BOSS2_N64) ? &boss2_move_attack_hb : &boss2_move_attack_pre_mg);
  432. else
  433. M_SetAnimation(self, self->spawnflags.has(SPAWNFLAG_BOSS2_N64) ? &boss2_move_attack_rocket2 : &boss2_move_attack_rocket);
  434. }
  435. void boss2_attack_mg(edict_t *self)
  436. {
  437. M_SetAnimation(self, self->spawnflags.has(SPAWNFLAG_BOSS2_N64) ? &boss2_move_attack_hb : &boss2_move_attack_mg);
  438. }
  439. void boss2_reattack_mg(edict_t *self)
  440. {
  441. if (infront(self, self->enemy) && frandom() <= 0.7f)
  442. boss2_attack_mg(self);
  443. else
  444. M_SetAnimation(self, &boss2_move_attack_post_mg);
  445. }
  446. PAIN(boss2_pain) (edict_t *self, edict_t *other, float kick, int damage, const mod_t &mod) -> void
  447. {
  448. if (level.time < self->pain_debounce_time)
  449. return;
  450. self->pain_debounce_time = level.time + 3_sec;
  451. // American wanted these at no attenuation
  452. if (damage < 10)
  453. gi.sound(self, CHAN_VOICE, sound_pain3, 1, ATTN_NONE, 0);
  454. else if (damage < 30)
  455. gi.sound(self, CHAN_VOICE, sound_pain1, 1, ATTN_NONE, 0);
  456. else
  457. gi.sound(self, CHAN_VOICE, sound_pain2, 1, ATTN_NONE, 0);
  458. if (!M_ShouldReactToPain(self, mod))
  459. return; // no pain anims in nightmare
  460. if (damage < 10)
  461. M_SetAnimation(self, &boss2_move_pain_light);
  462. else if (damage < 30)
  463. M_SetAnimation(self, &boss2_move_pain_light);
  464. else
  465. M_SetAnimation(self, &boss2_move_pain_heavy);
  466. }
  467. MONSTERINFO_SETSKIN(boss2_setskin) (edict_t *self) -> void
  468. {
  469. if (self->health < (self->max_health / 2))
  470. self->s.skinnum = 1;
  471. else
  472. self->s.skinnum = 0;
  473. }
  474. static void boss2_gib(edict_t *self)
  475. {
  476. gi.WriteByte(svc_temp_entity);
  477. gi.WriteByte(TE_EXPLOSION1_BIG);
  478. gi.WritePosition(self->s.origin);
  479. gi.multicast(self->s.origin, MULTICAST_PHS, false);
  480. self->s.sound = 0;
  481. self->s.skinnum /= 2;
  482. self->gravityVector.z = -1.0f;
  483. ThrowGibs(self, 500, {
  484. { 2, "models/objects/gibs/sm_meat/tris.md2" },
  485. { 2, "models/objects/gibs/sm_metal/tris.md2", GIB_METALLIC },
  486. { "models/monsters/boss2/gibs/chest.md2", GIB_SKINNED },
  487. { 2, "models/monsters/boss2/gibs/chaingun.md2", GIB_SKINNED | GIB_UPRIGHT },
  488. { "models/monsters/boss2/gibs/cpu.md2", GIB_SKINNED | GIB_UPRIGHT },
  489. { "models/monsters/boss2/gibs/engine.md2", GIB_SKINNED },
  490. { "models/monsters/boss2/gibs/rocket.md2", GIB_SKINNED | GIB_UPRIGHT },
  491. { "models/monsters/boss2/gibs/spine.md2", GIB_SKINNED },
  492. { 2, "models/monsters/boss2/gibs/wing.md2", GIB_SKINNED | GIB_UPRIGHT },
  493. { "models/monsters/boss2/gibs/larm.md2", GIB_SKINNED | GIB_UPRIGHT },
  494. { "models/monsters/boss2/gibs/rarm.md2", GIB_SKINNED | GIB_UPRIGHT },
  495. { "models/monsters/boss2/gibs/larm.md2", 2.0f, GIB_SKINNED | GIB_UPRIGHT },
  496. { "models/monsters/boss2/gibs/rarm.md2", 2.0f, GIB_SKINNED | GIB_UPRIGHT },
  497. { "models/monsters/boss2/gibs/larm.md2", 1.35f, GIB_SKINNED | GIB_UPRIGHT },
  498. { "models/monsters/boss2/gibs/rarm.md2", 1.35f, GIB_SKINNED | GIB_UPRIGHT },
  499. { "models/monsters/boss2/gibs/head.md2", GIB_SKINNED | GIB_METALLIC | GIB_HEAD }
  500. });
  501. }
  502. void boss2_dead(edict_t *self)
  503. {
  504. // no blowy on deady
  505. if (self->spawnflags.has(SPAWNFLAG_MONSTER_DEAD))
  506. {
  507. self->deadflag = false;
  508. self->takedamage = true;
  509. return;
  510. }
  511. boss2_gib(self);
  512. }
  513. DIE(boss2_die) (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, const vec3_t &point, const mod_t &mod) -> void
  514. {
  515. if (self->spawnflags.has(SPAWNFLAG_MONSTER_DEAD))
  516. {
  517. // check for gib
  518. if (M_CheckGib(self, mod))
  519. {
  520. boss2_gib(self);
  521. self->deadflag = true;
  522. return;
  523. }
  524. if (self->deadflag)
  525. return;
  526. }
  527. else
  528. {
  529. gi.sound(self, CHAN_VOICE, sound_death, 1, ATTN_NONE, 0);
  530. self->deadflag = true;
  531. self->takedamage = false;
  532. self->count = 0;
  533. self->velocity = {};
  534. self->gravityVector.z *= 0.30f;
  535. }
  536. M_SetAnimation(self, &boss2_move_death);
  537. }
  538. // [Paril-KEX] use generic function
  539. MONSTERINFO_CHECKATTACK(Boss2_CheckAttack) (edict_t *self) -> bool
  540. {
  541. return M_CheckAttack_Base(self, 0.4f, 0.8f, 0.8f, 0.8f, 0.f, 0.f);
  542. }
  543. /*QUAKED monster_boss2 (1 .5 0) (-56 -56 0) (56 56 80) Ambush Trigger_Spawn Sight Hyperblaster
  544. */
  545. void SP_monster_boss2(edict_t *self)
  546. {
  547. if ( !M_AllowSpawn( self ) ) {
  548. G_FreeEdict( self );
  549. return;
  550. }
  551. sound_pain1.assign("bosshovr/bhvpain1.wav");
  552. sound_pain2.assign("bosshovr/bhvpain2.wav");
  553. sound_pain3.assign("bosshovr/bhvpain3.wav");
  554. sound_death.assign("bosshovr/bhvdeth1.wav");
  555. sound_search1.assign("bosshovr/bhvunqv1.wav");
  556. gi.soundindex("tank/rocket.wav");
  557. if (self->spawnflags.has(SPAWNFLAG_BOSS2_N64))
  558. gi.soundindex("flyer/flyatck3.wav");
  559. else
  560. gi.soundindex("infantry/infatck1.wav");
  561. self->monsterinfo.weapon_sound = gi.soundindex("bosshovr/bhvengn1.wav");
  562. self->movetype = MOVETYPE_STEP;
  563. self->solid = SOLID_BBOX;
  564. self->s.modelindex = gi.modelindex("models/monsters/boss2/tris.md2");
  565. gi.modelindex("models/monsters/boss2/gibs/chaingun.md2");
  566. gi.modelindex("models/monsters/boss2/gibs/chest.md2");
  567. gi.modelindex("models/monsters/boss2/gibs/cpu.md2");
  568. gi.modelindex("models/monsters/boss2/gibs/engine.md2");
  569. gi.modelindex("models/monsters/boss2/gibs/head.md2");
  570. gi.modelindex("models/monsters/boss2/gibs/larm.md2");
  571. gi.modelindex("models/monsters/boss2/gibs/rarm.md2");
  572. gi.modelindex("models/monsters/boss2/gibs/rocket.md2");
  573. gi.modelindex("models/monsters/boss2/gibs/spine.md2");
  574. gi.modelindex("models/monsters/boss2/gibs/wing.md2");
  575. self->mins = { -56, -56, 0 };
  576. self->maxs = { 56, 56, 80 };
  577. self->health = 2000 * st.health_multiplier;
  578. self->gib_health = -200;
  579. self->mass = 1000;
  580. self->yaw_speed = 50;
  581. self->flags |= FL_IMMUNE_LASER;
  582. self->pain = boss2_pain;
  583. self->die = boss2_die;
  584. self->monsterinfo.stand = boss2_stand;
  585. self->monsterinfo.walk = boss2_walk;
  586. self->monsterinfo.run = boss2_run;
  587. self->monsterinfo.attack = boss2_attack;
  588. self->monsterinfo.search = boss2_search;
  589. self->monsterinfo.checkattack = Boss2_CheckAttack;
  590. self->monsterinfo.setskin = boss2_setskin;
  591. gi.linkentity(self);
  592. M_SetAnimation(self, &boss2_move_stand);
  593. self->monsterinfo.scale = MODEL_SCALE;
  594. // [Paril-KEX]
  595. self->monsterinfo.aiflags |= AI_IGNORE_SHOTS;
  596. flymonster_start(self);
  597. }