m_mutant.cpp 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743
  1. // Copyright (c) ZeniMax Media Inc.
  2. // Licensed under the GNU General Public License 2.0.
  3. /*
  4. ==============================================================================
  5. mutant
  6. ==============================================================================
  7. */
  8. #include "g_local.h"
  9. #include "m_mutant.h"
  10. constexpr spawnflags_t SPAWNFLAG_MUTANT_NOJUMPING = 8_spawnflag;
  11. static cached_soundindex sound_swing;
  12. static cached_soundindex sound_hit;
  13. static cached_soundindex sound_hit2;
  14. static cached_soundindex sound_death;
  15. static cached_soundindex sound_idle;
  16. static cached_soundindex sound_pain1;
  17. static cached_soundindex sound_pain2;
  18. static cached_soundindex sound_sight;
  19. static cached_soundindex sound_search;
  20. static cached_soundindex sound_step1;
  21. static cached_soundindex sound_step2;
  22. static cached_soundindex sound_step3;
  23. static cached_soundindex sound_thud;
  24. //
  25. // SOUNDS
  26. //
  27. void mutant_step(edict_t *self)
  28. {
  29. int n = irandom(3);
  30. if (n == 0)
  31. gi.sound(self, CHAN_BODY, sound_step1, 1, ATTN_NORM, 0);
  32. else if (n == 1)
  33. gi.sound(self, CHAN_BODY, sound_step2, 1, ATTN_NORM, 0);
  34. else
  35. gi.sound(self, CHAN_BODY, sound_step3, 1, ATTN_NORM, 0);
  36. }
  37. MONSTERINFO_SIGHT(mutant_sight) (edict_t *self, edict_t *other) -> void
  38. {
  39. gi.sound(self, CHAN_VOICE, sound_sight, 1, ATTN_NORM, 0);
  40. }
  41. MONSTERINFO_SEARCH(mutant_search) (edict_t *self) -> void
  42. {
  43. gi.sound(self, CHAN_VOICE, sound_search, 1, ATTN_NORM, 0);
  44. }
  45. void mutant_swing(edict_t *self)
  46. {
  47. gi.sound(self, CHAN_VOICE, sound_swing, 1, ATTN_NORM, 0);
  48. }
  49. //
  50. // STAND
  51. //
  52. mframe_t mutant_frames_stand[] = {
  53. { ai_stand },
  54. { ai_stand },
  55. { ai_stand },
  56. { ai_stand },
  57. { ai_stand },
  58. { ai_stand },
  59. { ai_stand },
  60. { ai_stand },
  61. { ai_stand },
  62. { ai_stand }, // 10
  63. { ai_stand },
  64. { ai_stand },
  65. { ai_stand },
  66. { ai_stand },
  67. { ai_stand },
  68. { ai_stand },
  69. { ai_stand },
  70. { ai_stand },
  71. { ai_stand },
  72. { ai_stand }, // 20
  73. { ai_stand },
  74. { ai_stand },
  75. { ai_stand },
  76. { ai_stand },
  77. { ai_stand },
  78. { ai_stand },
  79. { ai_stand },
  80. { ai_stand },
  81. { ai_stand },
  82. { ai_stand }, // 30
  83. { ai_stand },
  84. { ai_stand },
  85. { ai_stand },
  86. { ai_stand },
  87. { ai_stand },
  88. { ai_stand },
  89. { ai_stand },
  90. { ai_stand },
  91. { ai_stand },
  92. { ai_stand }, // 40
  93. { ai_stand },
  94. { ai_stand },
  95. { ai_stand },
  96. { ai_stand },
  97. { ai_stand },
  98. { ai_stand },
  99. { ai_stand },
  100. { ai_stand },
  101. { ai_stand },
  102. { ai_stand }, // 50
  103. { ai_stand }
  104. };
  105. MMOVE_T(mutant_move_stand) = { FRAME_stand101, FRAME_stand151, mutant_frames_stand, nullptr };
  106. MONSTERINFO_STAND(mutant_stand) (edict_t *self) -> void
  107. {
  108. M_SetAnimation(self, &mutant_move_stand);
  109. }
  110. //
  111. // IDLE
  112. //
  113. void mutant_idle_loop(edict_t *self)
  114. {
  115. if (frandom() < 0.75f)
  116. self->monsterinfo.nextframe = FRAME_stand155;
  117. }
  118. mframe_t mutant_frames_idle[] = {
  119. { ai_stand },
  120. { ai_stand },
  121. { ai_stand },
  122. { ai_stand }, // scratch loop start
  123. { ai_stand },
  124. { ai_stand },
  125. { ai_stand, 0, mutant_idle_loop }, // scratch loop end
  126. { ai_stand },
  127. { ai_stand },
  128. { ai_stand },
  129. { ai_stand },
  130. { ai_stand },
  131. { ai_stand }
  132. };
  133. MMOVE_T(mutant_move_idle) = { FRAME_stand152, FRAME_stand164, mutant_frames_idle, mutant_stand };
  134. MONSTERINFO_IDLE(mutant_idle) (edict_t *self) -> void
  135. {
  136. M_SetAnimation(self, &mutant_move_idle);
  137. gi.sound(self, CHAN_VOICE, sound_idle, 1, ATTN_IDLE, 0);
  138. }
  139. //
  140. // WALK
  141. //
  142. mframe_t mutant_frames_walk[] = {
  143. { ai_walk, 3 },
  144. { ai_walk, 1 },
  145. { ai_walk, 5 },
  146. { ai_walk, 10 },
  147. { ai_walk, 13 },
  148. { ai_walk, 10 },
  149. { ai_walk },
  150. { ai_walk, 5 },
  151. { ai_walk, 6 },
  152. { ai_walk, 16 },
  153. { ai_walk, 15 },
  154. { ai_walk, 6 }
  155. };
  156. MMOVE_T(mutant_move_walk) = { FRAME_walk05, FRAME_walk16, mutant_frames_walk, nullptr };
  157. void mutant_walk_loop(edict_t *self)
  158. {
  159. M_SetAnimation(self, &mutant_move_walk);
  160. }
  161. mframe_t mutant_frames_start_walk[] = {
  162. { ai_walk, 5 },
  163. { ai_walk, 5 },
  164. { ai_walk, -2 },
  165. { ai_walk, 1 }
  166. };
  167. MMOVE_T(mutant_move_start_walk) = { FRAME_walk01, FRAME_walk04, mutant_frames_start_walk, mutant_walk_loop };
  168. MONSTERINFO_WALK(mutant_walk) (edict_t *self) -> void
  169. {
  170. M_SetAnimation(self, &mutant_move_start_walk);
  171. }
  172. //
  173. // RUN
  174. //
  175. mframe_t mutant_frames_run[] = {
  176. { ai_run, 40 },
  177. { ai_run, 40, mutant_step },
  178. { ai_run, 24 },
  179. { ai_run, 5, mutant_step },
  180. { ai_run, 17 },
  181. { ai_run, 10 }
  182. };
  183. MMOVE_T(mutant_move_run) = { FRAME_run03, FRAME_run08, mutant_frames_run, nullptr };
  184. MONSTERINFO_RUN(mutant_run) (edict_t *self) -> void
  185. {
  186. if (self->monsterinfo.aiflags & AI_STAND_GROUND)
  187. M_SetAnimation(self, &mutant_move_stand);
  188. else
  189. M_SetAnimation(self, &mutant_move_run);
  190. }
  191. //
  192. // MELEE
  193. //
  194. void mutant_hit_left(edict_t *self)
  195. {
  196. vec3_t aim = { MELEE_DISTANCE, self->mins[0], 8 };
  197. if (fire_hit(self, aim, irandom(5, 15), 100))
  198. gi.sound(self, CHAN_WEAPON, sound_hit, 1, ATTN_NORM, 0);
  199. else
  200. {
  201. gi.sound(self, CHAN_WEAPON, sound_swing, 1, ATTN_NORM, 0);
  202. self->monsterinfo.melee_debounce_time = level.time + 1.5_sec;
  203. }
  204. }
  205. void mutant_hit_right(edict_t *self)
  206. {
  207. vec3_t aim = { MELEE_DISTANCE, self->maxs[0], 8 };
  208. if (fire_hit(self, aim, irandom(5, 15), 100))
  209. gi.sound(self, CHAN_WEAPON, sound_hit2, 1, ATTN_NORM, 0);
  210. else
  211. {
  212. gi.sound(self, CHAN_WEAPON, sound_swing, 1, ATTN_NORM, 0);
  213. self->monsterinfo.melee_debounce_time = level.time + 1.5_sec;
  214. }
  215. }
  216. void mutant_check_refire(edict_t *self)
  217. {
  218. if (!self->enemy || !self->enemy->inuse || self->enemy->health <= 0)
  219. return;
  220. if ((self->monsterinfo.melee_debounce_time <= level.time) && ((frandom() < 0.5f) || (range_to(self, self->enemy) <= RANGE_MELEE)))
  221. self->monsterinfo.nextframe = FRAME_attack09;
  222. }
  223. mframe_t mutant_frames_attack[] = {
  224. { ai_charge },
  225. { ai_charge },
  226. { ai_charge, 0, mutant_hit_left },
  227. { ai_charge },
  228. { ai_charge },
  229. { ai_charge, 0, mutant_hit_right },
  230. { ai_charge, 0, mutant_check_refire }
  231. };
  232. MMOVE_T(mutant_move_attack) = { FRAME_attack09, FRAME_attack15, mutant_frames_attack, mutant_run };
  233. MONSTERINFO_MELEE(mutant_melee) (edict_t *self) -> void
  234. {
  235. M_SetAnimation(self, &mutant_move_attack);
  236. }
  237. //
  238. // ATTACK
  239. //
  240. TOUCH(mutant_jump_touch) (edict_t *self, edict_t *other, const trace_t &tr, bool other_touching_self) -> void
  241. {
  242. if (self->health <= 0)
  243. {
  244. self->touch = nullptr;
  245. return;
  246. }
  247. if (self->style == 1 && other->takedamage)
  248. {
  249. // [Paril-KEX] only if we're actually moving fast enough to hurt
  250. if (self->velocity.length() > 30)
  251. {
  252. vec3_t point;
  253. vec3_t normal;
  254. int damage;
  255. normal = self->velocity;
  256. normal.normalize();
  257. point = self->s.origin + (normal * self->maxs[0]);
  258. damage = (int) frandom(40, 50);
  259. T_Damage(other, self, self, self->velocity, point, normal, damage, damage, DAMAGE_NONE, MOD_UNKNOWN);
  260. self->style = 0;
  261. }
  262. }
  263. if (!M_CheckBottom(self))
  264. {
  265. if (self->groundentity)
  266. {
  267. self->monsterinfo.nextframe = FRAME_attack02;
  268. self->touch = nullptr;
  269. }
  270. return;
  271. }
  272. self->touch = nullptr;
  273. }
  274. void mutant_jump_takeoff(edict_t *self)
  275. {
  276. vec3_t forward;
  277. gi.sound(self, CHAN_VOICE, sound_sight, 1, ATTN_NORM, 0);
  278. AngleVectors(self->s.angles, forward, nullptr, nullptr);
  279. self->s.origin[2] += 1;
  280. self->velocity = forward * 425;
  281. self->velocity[2] = 160;
  282. self->groundentity = nullptr;
  283. self->monsterinfo.aiflags |= AI_DUCKED;
  284. self->monsterinfo.attack_finished = level.time + 3_sec;
  285. self->style = 1;
  286. self->touch = mutant_jump_touch;
  287. }
  288. void mutant_check_landing(edict_t *self)
  289. {
  290. monster_jump_finished(self);
  291. if (self->groundentity)
  292. {
  293. gi.sound(self, CHAN_WEAPON, sound_thud, 1, ATTN_NORM, 0);
  294. self->monsterinfo.attack_finished = level.time + random_time(500_ms, 1.5_sec);
  295. if (self->monsterinfo.unduck)
  296. self->monsterinfo.unduck(self);
  297. if (range_to(self, self->enemy) <= RANGE_MELEE * 2.f)
  298. self->monsterinfo.melee(self);
  299. return;
  300. }
  301. if (level.time > self->monsterinfo.attack_finished)
  302. self->monsterinfo.nextframe = FRAME_attack02;
  303. else
  304. self->monsterinfo.nextframe = FRAME_attack05;
  305. }
  306. mframe_t mutant_frames_jump[] = {
  307. { ai_charge },
  308. { ai_charge, 17 },
  309. { ai_charge, 15, mutant_jump_takeoff },
  310. { ai_charge, 15 },
  311. { ai_charge, 15, mutant_check_landing },
  312. { ai_charge },
  313. { ai_charge, 3 },
  314. { ai_charge }
  315. };
  316. MMOVE_T(mutant_move_jump) = { FRAME_attack01, FRAME_attack08, mutant_frames_jump, mutant_run };
  317. MONSTERINFO_ATTACK(mutant_jump) (edict_t *self) -> void
  318. {
  319. M_SetAnimation(self, &mutant_move_jump);
  320. }
  321. //
  322. // CHECKATTACK
  323. //
  324. bool mutant_check_melee(edict_t *self)
  325. {
  326. return range_to(self, self->enemy) <= RANGE_MELEE && self->monsterinfo.melee_debounce_time <= level.time;
  327. }
  328. bool mutant_check_jump(edict_t *self)
  329. {
  330. vec3_t v;
  331. float distance;
  332. // Paril: no harm in letting them jump down if you're below them
  333. // if (self->absmin[2] > (self->enemy->absmin[2] + 0.75 * self->enemy->size[2]))
  334. // return false;
  335. // don't jump if there's no way we can reach standing height
  336. if (self->absmin[2] + 125 < self->enemy->absmin[2])
  337. return false;
  338. v[0] = self->s.origin[0] - self->enemy->s.origin[0];
  339. v[1] = self->s.origin[1] - self->enemy->s.origin[1];
  340. v[2] = 0;
  341. distance = v.length();
  342. // if we're not trying to avoid a melee, then don't jump
  343. if (distance < 100 && self->monsterinfo.melee_debounce_time <= level.time)
  344. return false;
  345. // only use it to close distance gaps
  346. if (distance > 265)
  347. return false;
  348. return self->monsterinfo.attack_finished < level.time && brandom();
  349. }
  350. MONSTERINFO_CHECKATTACK(mutant_checkattack) (edict_t *self) -> bool
  351. {
  352. if (!self->enemy || self->enemy->health <= 0)
  353. return false;
  354. if (mutant_check_melee(self))
  355. {
  356. self->monsterinfo.attack_state = AS_MELEE;
  357. return true;
  358. }
  359. if (!self->spawnflags.has(SPAWNFLAG_MUTANT_NOJUMPING) && mutant_check_jump(self))
  360. {
  361. self->monsterinfo.attack_state = AS_MISSILE;
  362. return true;
  363. }
  364. return false;
  365. }
  366. //
  367. // PAIN
  368. //
  369. mframe_t mutant_frames_pain1[] = {
  370. { ai_move, 4 },
  371. { ai_move, -3 },
  372. { ai_move, -8 },
  373. { ai_move, 2 },
  374. { ai_move, 5 }
  375. };
  376. MMOVE_T(mutant_move_pain1) = { FRAME_pain101, FRAME_pain105, mutant_frames_pain1, mutant_run };
  377. mframe_t mutant_frames_pain2[] = {
  378. { ai_move, -24 },
  379. { ai_move, 11 },
  380. { ai_move, 5 },
  381. { ai_move, -2 },
  382. { ai_move, 6 },
  383. { ai_move, 4 }
  384. };
  385. MMOVE_T(mutant_move_pain2) = { FRAME_pain201, FRAME_pain206, mutant_frames_pain2, mutant_run };
  386. mframe_t mutant_frames_pain3[] = {
  387. { ai_move, -22 },
  388. { ai_move, 3 },
  389. { ai_move, 3 },
  390. { ai_move, 2 },
  391. { ai_move, 1 },
  392. { ai_move, 1 },
  393. { ai_move, 6 },
  394. { ai_move, 3 },
  395. { ai_move, 2 },
  396. { ai_move },
  397. { ai_move, 1 }
  398. };
  399. MMOVE_T(mutant_move_pain3) = { FRAME_pain301, FRAME_pain311, mutant_frames_pain3, mutant_run };
  400. PAIN(mutant_pain) (edict_t *self, edict_t *other, float kick, int damage, const mod_t &mod) -> void
  401. {
  402. float r;
  403. if (level.time < self->pain_debounce_time)
  404. return;
  405. self->pain_debounce_time = level.time + 3_sec;
  406. r = frandom();
  407. if (r < 0.33f)
  408. gi.sound(self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0);
  409. else if (r < 0.66f)
  410. gi.sound(self, CHAN_VOICE, sound_pain2, 1, ATTN_NORM, 0);
  411. else
  412. gi.sound(self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0);
  413. if (!M_ShouldReactToPain(self, mod))
  414. return; // no pain anims in nightmare
  415. if (r < 0.33f)
  416. M_SetAnimation(self, &mutant_move_pain1);
  417. else if (r < 0.66f)
  418. M_SetAnimation(self, &mutant_move_pain2);
  419. else
  420. M_SetAnimation(self, &mutant_move_pain3);
  421. }
  422. MONSTERINFO_SETSKIN(mutant_setskin) (edict_t *self) -> void
  423. {
  424. if (self->health < (self->max_health / 2))
  425. self->s.skinnum = 1;
  426. else
  427. self->s.skinnum = 0;
  428. }
  429. //
  430. // DEATH
  431. //
  432. void mutant_shrink(edict_t *self)
  433. {
  434. self->maxs[2] = 0;
  435. self->svflags |= SVF_DEADMONSTER;
  436. gi.linkentity(self);
  437. }
  438. // [Paril-KEX]
  439. static void ai_move_slide_right(edict_t *self, float dist)
  440. {
  441. M_walkmove(self, self->s.angles[YAW] + 90, dist);
  442. }
  443. static void ai_move_slide_left(edict_t *self, float dist)
  444. {
  445. M_walkmove(self, self->s.angles[YAW] - 90, dist);
  446. }
  447. mframe_t mutant_frames_death1[] = {
  448. { ai_move_slide_right },
  449. { ai_move_slide_right },
  450. { ai_move_slide_right },
  451. { ai_move_slide_right, 2 },
  452. { ai_move_slide_right, 5 },
  453. { ai_move_slide_right, 7, mutant_shrink },
  454. { ai_move_slide_right, 6 },
  455. { ai_move_slide_right, 2 },
  456. { ai_move_slide_right }
  457. };
  458. MMOVE_T(mutant_move_death1) = { FRAME_death101, FRAME_death109, mutant_frames_death1, monster_dead };
  459. mframe_t mutant_frames_death2[] = {
  460. { ai_move_slide_left },
  461. { ai_move_slide_left },
  462. { ai_move_slide_left },
  463. { ai_move_slide_left, 1 },
  464. { ai_move_slide_left, 3, mutant_shrink },
  465. { ai_move_slide_left, 6 },
  466. { ai_move_slide_left, 8 },
  467. { ai_move_slide_left, 5 },
  468. { ai_move_slide_left, 2 },
  469. { ai_move_slide_left }
  470. };
  471. MMOVE_T(mutant_move_death2) = { FRAME_death201, FRAME_death210, mutant_frames_death2, monster_dead };
  472. DIE(mutant_die) (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, const vec3_t &point, const mod_t &mod) -> void
  473. {
  474. if (M_CheckGib(self, mod))
  475. {
  476. gi.sound(self, CHAN_VOICE, gi.soundindex("misc/udeath.wav"), 1, ATTN_NORM, 0);
  477. self->s.skinnum /= 2;
  478. ThrowGibs(self, damage, {
  479. { 2, "models/objects/gibs/bone/tris.md2" },
  480. { 4, "models/objects/gibs/sm_meat/tris.md2" },
  481. { 2, "models/monsters/mutant/gibs/hand.md2", GIB_SKINNED | GIB_UPRIGHT },
  482. { 2, "models/monsters/mutant/gibs/foot.md2", GIB_SKINNED },
  483. { "models/monsters/mutant/gibs/chest.md2", GIB_SKINNED },
  484. { "models/monsters/mutant/gibs/head.md2", GIB_SKINNED | GIB_HEAD }
  485. });
  486. self->deadflag = true;
  487. return;
  488. }
  489. if (self->deadflag)
  490. return;
  491. gi.sound(self, CHAN_VOICE, sound_death, 1, ATTN_NORM, 0);
  492. self->deadflag = true;
  493. self->takedamage = true;
  494. if (frandom() < 0.5f)
  495. M_SetAnimation(self, &mutant_move_death1);
  496. else
  497. M_SetAnimation(self, &mutant_move_death2);
  498. }
  499. //================
  500. // ROGUE
  501. void mutant_jump_down(edict_t *self)
  502. {
  503. vec3_t forward, up;
  504. AngleVectors(self->s.angles, forward, nullptr, up);
  505. self->velocity += (forward * 100);
  506. self->velocity += (up * 300);
  507. }
  508. void mutant_jump_up(edict_t *self)
  509. {
  510. vec3_t forward, up;
  511. AngleVectors(self->s.angles, forward, nullptr, up);
  512. self->velocity += (forward * 200);
  513. self->velocity += (up * 450);
  514. }
  515. void mutant_jump_wait_land(edict_t *self)
  516. {
  517. if (!monster_jump_finished(self) && self->groundentity == nullptr)
  518. self->monsterinfo.nextframe = self->s.frame;
  519. else
  520. self->monsterinfo.nextframe = self->s.frame + 1;
  521. }
  522. mframe_t mutant_frames_jump_up[] = {
  523. { ai_move, -8 },
  524. { ai_move, -8, mutant_jump_up },
  525. { ai_move, 0, mutant_jump_wait_land },
  526. { ai_move },
  527. { ai_move }
  528. };
  529. MMOVE_T(mutant_move_jump_up) = { FRAME_jump01, FRAME_jump05, mutant_frames_jump_up, mutant_run };
  530. mframe_t mutant_frames_jump_down[] = {
  531. { ai_move },
  532. { ai_move, 0, mutant_jump_down },
  533. { ai_move, 0, mutant_jump_wait_land },
  534. { ai_move },
  535. { ai_move }
  536. };
  537. MMOVE_T(mutant_move_jump_down) = { FRAME_jump01, FRAME_jump05, mutant_frames_jump_down, mutant_run };
  538. void mutant_jump_updown(edict_t *self, blocked_jump_result_t result)
  539. {
  540. if (!self->enemy)
  541. return;
  542. if (result == blocked_jump_result_t::JUMP_JUMP_UP)
  543. M_SetAnimation(self, &mutant_move_jump_up);
  544. else
  545. M_SetAnimation(self, &mutant_move_jump_down);
  546. }
  547. /*
  548. ===
  549. Blocked
  550. ===
  551. */
  552. MONSTERINFO_BLOCKED(mutant_blocked) (edict_t *self, float dist) -> bool
  553. {
  554. if (auto result = blocked_checkjump(self, dist); result != blocked_jump_result_t::NO_JUMP)
  555. {
  556. if (result != blocked_jump_result_t::JUMP_TURN)
  557. mutant_jump_updown(self, result);
  558. return true;
  559. }
  560. if (blocked_checkplat(self, dist))
  561. return true;
  562. return false;
  563. }
  564. // ROGUE
  565. //================
  566. //
  567. // SPAWN
  568. //
  569. /*QUAKED monster_mutant (1 .5 0) (-32 -32 -24) (32 32 32) Ambush Trigger_Spawn Sight NoJumping
  570. model="models/monsters/mutant/tris.md2"
  571. */
  572. void SP_monster_mutant(edict_t *self)
  573. {
  574. if ( !M_AllowSpawn( self ) ) {
  575. G_FreeEdict( self );
  576. return;
  577. }
  578. sound_swing.assign("mutant/mutatck1.wav");
  579. sound_hit.assign("mutant/mutatck2.wav");
  580. sound_hit2.assign("mutant/mutatck3.wav");
  581. sound_death.assign("mutant/mutdeth1.wav");
  582. sound_idle.assign("mutant/mutidle1.wav");
  583. sound_pain1.assign("mutant/mutpain1.wav");
  584. sound_pain2.assign("mutant/mutpain2.wav");
  585. sound_sight.assign("mutant/mutsght1.wav");
  586. sound_search.assign("mutant/mutsrch1.wav");
  587. sound_step1.assign("mutant/step1.wav");
  588. sound_step2.assign("mutant/step2.wav");
  589. sound_step3.assign("mutant/step3.wav");
  590. sound_thud.assign("mutant/thud1.wav");
  591. self->monsterinfo.aiflags |= AI_STINKY;
  592. self->movetype = MOVETYPE_STEP;
  593. self->solid = SOLID_BBOX;
  594. self->s.modelindex = gi.modelindex("models/monsters/mutant/tris.md2");
  595. gi.modelindex("models/monsters/mutant/gibs/head.md2");
  596. gi.modelindex("models/monsters/mutant/gibs/chest.md2");
  597. gi.modelindex("models/monsters/mutant/gibs/hand.md2");
  598. gi.modelindex("models/monsters/mutant/gibs/foot.md2");
  599. self->mins = { -18, -18, -24 };
  600. self->maxs = { 18, 18, 30 };
  601. self->health = 300 * st.health_multiplier;
  602. self->gib_health = -120;
  603. self->mass = 300;
  604. self->pain = mutant_pain;
  605. self->die = mutant_die;
  606. self->monsterinfo.stand = mutant_stand;
  607. self->monsterinfo.walk = mutant_walk;
  608. self->monsterinfo.run = mutant_run;
  609. self->monsterinfo.dodge = nullptr;
  610. self->monsterinfo.attack = mutant_jump;
  611. self->monsterinfo.melee = mutant_melee;
  612. self->monsterinfo.sight = mutant_sight;
  613. self->monsterinfo.search = mutant_search;
  614. self->monsterinfo.idle = mutant_idle;
  615. self->monsterinfo.checkattack = mutant_checkattack;
  616. self->monsterinfo.blocked = mutant_blocked; // PGM
  617. self->monsterinfo.setskin = mutant_setskin;
  618. gi.linkentity(self);
  619. M_SetAnimation(self, &mutant_move_stand);
  620. self->monsterinfo.combat_style = COMBAT_MELEE;
  621. self->monsterinfo.scale = MODEL_SCALE;
  622. self->monsterinfo.can_jump = !(self->spawnflags & SPAWNFLAG_MUTANT_NOJUMPING);
  623. self->monsterinfo.drop_height = 256;
  624. self->monsterinfo.jump_height = 68;
  625. walkmonster_start(self);
  626. }