m_insane.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677
  1. // Copyright (c) ZeniMax Media Inc.
  2. // Licensed under the GNU General Public License 2.0.
  3. /*
  4. ==============================================================================
  5. insane
  6. ==============================================================================
  7. */
  8. #include "g_local.h"
  9. #include "m_insane.h"
  10. static int sound_fist;
  11. static int sound_shake;
  12. static int sound_moan;
  13. static int sound_scream[8];
  14. void insane_fist (edict_t *self)
  15. {
  16. gi.sound (self, CHAN_VOICE, sound_fist, 1, ATTN_IDLE, 0);
  17. }
  18. void insane_shake (edict_t *self)
  19. {
  20. gi.sound (self, CHAN_VOICE, sound_shake, 1, ATTN_IDLE, 0);
  21. }
  22. void insane_moan (edict_t *self)
  23. {
  24. gi.sound (self, CHAN_VOICE, sound_moan, 1, ATTN_IDLE, 0);
  25. }
  26. void insane_scream (edict_t *self)
  27. {
  28. gi.sound (self, CHAN_VOICE, sound_scream[rand()%8], 1, ATTN_IDLE, 0);
  29. }
  30. void insane_stand (edict_t *self);
  31. void insane_dead (edict_t *self);
  32. void insane_cross (edict_t *self);
  33. void insane_walk (edict_t *self);
  34. void insane_run (edict_t *self);
  35. void insane_checkdown (edict_t *self);
  36. void insane_checkup (edict_t *self);
  37. void insane_onground (edict_t *self);
  38. mframe_t insane_frames_stand_normal [] =
  39. {
  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, insane_checkdown
  46. };
  47. mmove_t insane_move_stand_normal = {FRAME_stand60, FRAME_stand65, insane_frames_stand_normal, insane_stand};
  48. mframe_t insane_frames_stand_insane [] =
  49. {
  50. ai_stand, 0, insane_shake,
  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, insane_checkdown
  80. };
  81. mmove_t insane_move_stand_insane = {FRAME_stand65, FRAME_stand94, insane_frames_stand_insane, insane_stand};
  82. mframe_t insane_frames_uptodown [] =
  83. {
  84. ai_move, 0, NULL,
  85. ai_move, 0, NULL,
  86. ai_move, 0, NULL,
  87. ai_move, 0, NULL,
  88. ai_move, 0, NULL,
  89. ai_move, 0, NULL,
  90. ai_move, 0, NULL,
  91. ai_move, 0, insane_moan,
  92. ai_move, 0, NULL,
  93. ai_move, 0, NULL,
  94. ai_move, 0, NULL,
  95. ai_move, 0, NULL,
  96. ai_move, 0, NULL,
  97. ai_move, 0, NULL,
  98. ai_move, 0, NULL,
  99. ai_move, 0, NULL,
  100. ai_move, 0, NULL,
  101. ai_move, 0, NULL,
  102. ai_move, 0, NULL,
  103. ai_move, 0, NULL,
  104. ai_move, 2.7, NULL,
  105. ai_move, 4.1, NULL,
  106. ai_move, 6, NULL,
  107. ai_move, 7.6, NULL,
  108. ai_move, 3.6, NULL,
  109. ai_move, 0, NULL,
  110. ai_move, 0, NULL,
  111. ai_move, 0, insane_fist,
  112. ai_move, 0, NULL,
  113. ai_move, 0, NULL,
  114. ai_move, 0, NULL,
  115. ai_move, 0, NULL,
  116. ai_move, 0, NULL,
  117. ai_move, 0, insane_fist,
  118. ai_move, 0, NULL,
  119. ai_move, 0, NULL,
  120. ai_move, 0, NULL,
  121. ai_move, 0, NULL,
  122. ai_move, 0, NULL,
  123. ai_move, 0, NULL
  124. };
  125. mmove_t insane_move_uptodown = {FRAME_stand1, FRAME_stand40, insane_frames_uptodown, insane_onground};
  126. mframe_t insane_frames_downtoup [] =
  127. {
  128. ai_move, -0.7, NULL, // 41
  129. ai_move, -1.2, NULL, // 42
  130. ai_move, -1.5, NULL, // 43
  131. ai_move, -4.5, NULL, // 44
  132. ai_move, -3.5, NULL, // 45
  133. ai_move, -0.2, NULL, // 46
  134. ai_move, 0, NULL, // 47
  135. ai_move, -1.3, NULL, // 48
  136. ai_move, -3, NULL, // 49
  137. ai_move, -2, NULL, // 50
  138. ai_move, 0, NULL, // 51
  139. ai_move, 0, NULL, // 52
  140. ai_move, 0, NULL, // 53
  141. ai_move, -3.3, NULL, // 54
  142. ai_move, -1.6, NULL, // 55
  143. ai_move, -0.3, NULL, // 56
  144. ai_move, 0, NULL, // 57
  145. ai_move, 0, NULL, // 58
  146. ai_move, 0, NULL // 59
  147. };
  148. mmove_t insane_move_downtoup = {FRAME_stand41, FRAME_stand59, insane_frames_downtoup, insane_stand};
  149. mframe_t insane_frames_jumpdown [] =
  150. {
  151. ai_move, 0.2, NULL,
  152. ai_move, 11.5, NULL,
  153. ai_move, 5.1, NULL,
  154. ai_move, 7.1, NULL,
  155. ai_move, 0, NULL
  156. };
  157. mmove_t insane_move_jumpdown = {FRAME_stand96, FRAME_stand100, insane_frames_jumpdown, insane_onground};
  158. mframe_t insane_frames_down [] =
  159. {
  160. ai_move, 0, NULL, // 100
  161. ai_move, 0, NULL,
  162. ai_move, 0, NULL,
  163. ai_move, 0, NULL,
  164. ai_move, 0, NULL,
  165. ai_move, 0, NULL,
  166. ai_move, 0, NULL,
  167. ai_move, 0, NULL,
  168. ai_move, 0, NULL,
  169. ai_move, 0, NULL,
  170. ai_move, 0, NULL, // 110
  171. ai_move, -1.7, NULL,
  172. ai_move, -1.6, NULL,
  173. ai_move, 0, NULL,
  174. ai_move, 0, NULL,
  175. ai_move, 0, NULL,
  176. ai_move, 0, insane_fist,
  177. ai_move, 0, NULL,
  178. ai_move, 0, NULL,
  179. ai_move, 0, NULL,
  180. ai_move, 0, NULL, // 120
  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. ai_move, 0, NULL,
  188. ai_move, 0, NULL,
  189. ai_move, 0, NULL,
  190. ai_move, 0, NULL, // 130
  191. ai_move, 0, NULL,
  192. ai_move, 0, NULL,
  193. ai_move, 0, insane_moan,
  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, // 140
  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. ai_move, 0, NULL,
  210. ai_move, 0, NULL, // 150
  211. ai_move, 0.5, NULL,
  212. ai_move, 0, NULL,
  213. ai_move, -0.2, insane_scream,
  214. ai_move, 0, NULL,
  215. ai_move, 0.2, NULL,
  216. ai_move, 0.4, NULL,
  217. ai_move, 0.6, NULL,
  218. ai_move, 0.8, NULL,
  219. ai_move, 0.7, NULL,
  220. ai_move, 0, insane_checkup // 160
  221. };
  222. mmove_t insane_move_down = {FRAME_stand100, FRAME_stand160, insane_frames_down, insane_onground};
  223. mframe_t insane_frames_walk_normal [] =
  224. {
  225. ai_walk, 0, insane_scream,
  226. ai_walk, 2.5, NULL,
  227. ai_walk, 3.5, NULL,
  228. ai_walk, 1.7, NULL,
  229. ai_walk, 2.3, NULL,
  230. ai_walk, 2.4, NULL,
  231. ai_walk, 2.2, NULL,
  232. ai_walk, 4.2, NULL,
  233. ai_walk, 5.6, NULL,
  234. ai_walk, 3.3, NULL,
  235. ai_walk, 2.4, NULL,
  236. ai_walk, 0.9, NULL,
  237. ai_walk, 0, NULL
  238. };
  239. mmove_t insane_move_walk_normal = {FRAME_walk27, FRAME_walk39, insane_frames_walk_normal, insane_walk};
  240. mmove_t insane_move_run_normal = {FRAME_walk27, FRAME_walk39, insane_frames_walk_normal, insane_run};
  241. mframe_t insane_frames_walk_insane [] =
  242. {
  243. ai_walk, 0, insane_scream, // walk 1
  244. ai_walk, 3.4, NULL, // walk 2
  245. ai_walk, 3.6, NULL, // 3
  246. ai_walk, 2.9, NULL, // 4
  247. ai_walk, 2.2, NULL, // 5
  248. ai_walk, 2.6, NULL, // 6
  249. ai_walk, 0, NULL, // 7
  250. ai_walk, 0.7, NULL, // 8
  251. ai_walk, 4.8, NULL, // 9
  252. ai_walk, 5.3, NULL, // 10
  253. ai_walk, 1.1, NULL, // 11
  254. ai_walk, 2, NULL, // 12
  255. ai_walk, 0.5, NULL, // 13
  256. ai_walk, 0, NULL, // 14
  257. ai_walk, 0, NULL, // 15
  258. ai_walk, 4.9, NULL, // 16
  259. ai_walk, 6.7, NULL, // 17
  260. ai_walk, 3.8, NULL, // 18
  261. ai_walk, 2, NULL, // 19
  262. ai_walk, 0.2, NULL, // 20
  263. ai_walk, 0, NULL, // 21
  264. ai_walk, 3.4, NULL, // 22
  265. ai_walk, 6.4, NULL, // 23
  266. ai_walk, 5, NULL, // 24
  267. ai_walk, 1.8, NULL, // 25
  268. ai_walk, 0, NULL // 26
  269. };
  270. mmove_t insane_move_walk_insane = {FRAME_walk1, FRAME_walk26, insane_frames_walk_insane, insane_walk};
  271. mmove_t insane_move_run_insane = {FRAME_walk1, FRAME_walk26, insane_frames_walk_insane, insane_run};
  272. mframe_t insane_frames_stand_pain [] =
  273. {
  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. };
  286. mmove_t insane_move_stand_pain = {FRAME_st_pain2, FRAME_st_pain12, insane_frames_stand_pain, insane_run};
  287. mframe_t insane_frames_stand_death [] =
  288. {
  289. ai_move, 0, NULL,
  290. ai_move, 0, NULL,
  291. ai_move, 0, NULL,
  292. ai_move, 0, NULL,
  293. ai_move, 0, NULL,
  294. ai_move, 0, NULL,
  295. ai_move, 0, NULL,
  296. ai_move, 0, NULL,
  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. };
  307. mmove_t insane_move_stand_death = {FRAME_st_death2, FRAME_st_death18, insane_frames_stand_death, insane_dead};
  308. mframe_t insane_frames_crawl [] =
  309. {
  310. ai_walk, 0, insane_scream,
  311. ai_walk, 1.5, NULL,
  312. ai_walk, 2.1, NULL,
  313. ai_walk, 3.6, NULL,
  314. ai_walk, 2, NULL,
  315. ai_walk, 0.9, NULL,
  316. ai_walk, 3, NULL,
  317. ai_walk, 3.4, NULL,
  318. ai_walk, 2.4, NULL
  319. };
  320. mmove_t insane_move_crawl = {FRAME_crawl1, FRAME_crawl9, insane_frames_crawl, NULL};
  321. mmove_t insane_move_runcrawl = {FRAME_crawl1, FRAME_crawl9, insane_frames_crawl, NULL};
  322. mframe_t insane_frames_crawl_pain [] =
  323. {
  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. };
  334. mmove_t insane_move_crawl_pain = {FRAME_cr_pain2, FRAME_cr_pain10, insane_frames_crawl_pain, insane_run};
  335. mframe_t insane_frames_crawl_death [] =
  336. {
  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. };
  345. mmove_t insane_move_crawl_death = {FRAME_cr_death10, FRAME_cr_death16, insane_frames_crawl_death, insane_dead};
  346. mframe_t insane_frames_cross [] =
  347. {
  348. ai_move, 0, insane_moan,
  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. 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. };
  364. mmove_t insane_move_cross = {FRAME_cross1, FRAME_cross15, insane_frames_cross, insane_cross};
  365. mframe_t insane_frames_struggle_cross [] =
  366. {
  367. ai_move, 0, insane_scream,
  368. ai_move, 0, NULL,
  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. };
  383. mmove_t insane_move_struggle_cross = {FRAME_cross16, FRAME_cross30, insane_frames_struggle_cross, insane_cross};
  384. void insane_cross (edict_t *self)
  385. {
  386. if (random() < 0.8)
  387. self->monsterinfo.currentmove = &insane_move_cross;
  388. else
  389. self->monsterinfo.currentmove = &insane_move_struggle_cross;
  390. }
  391. void insane_walk (edict_t *self)
  392. {
  393. if ( self->spawnflags & 16 ) // Hold Ground?
  394. if (self->s.frame == FRAME_cr_pain10)
  395. {
  396. self->monsterinfo.currentmove = &insane_move_down;
  397. return;
  398. }
  399. if (self->spawnflags & 4)
  400. self->monsterinfo.currentmove = &insane_move_crawl;
  401. else
  402. if (random() <= 0.5)
  403. self->monsterinfo.currentmove = &insane_move_walk_normal;
  404. else
  405. self->monsterinfo.currentmove = &insane_move_walk_insane;
  406. }
  407. void insane_run (edict_t *self)
  408. {
  409. if ( self->spawnflags & 16 ) // Hold Ground?
  410. if (self->s.frame == FRAME_cr_pain10)
  411. {
  412. self->monsterinfo.currentmove = &insane_move_down;
  413. return;
  414. }
  415. if (self->spawnflags & 4) // Crawling?
  416. self->monsterinfo.currentmove = &insane_move_runcrawl;
  417. else
  418. if (random() <= 0.5) // Else, mix it up
  419. self->monsterinfo.currentmove = &insane_move_run_normal;
  420. else
  421. self->monsterinfo.currentmove = &insane_move_run_insane;
  422. }
  423. void insane_pain (edict_t *self, edict_t *other, float kick, int damage)
  424. {
  425. int l,r;
  426. // if (self->health < (self->max_health / 2))
  427. // self->s.skinnum = 1;
  428. if (level.time < self->pain_debounce_time)
  429. return;
  430. self->pain_debounce_time = level.time + 3;
  431. r = 1 + (rand()&1);
  432. if (self->health < 25)
  433. l = 25;
  434. else if (self->health < 50)
  435. l = 50;
  436. else if (self->health < 75)
  437. l = 75;
  438. else
  439. l = 100;
  440. gi.sound (self, CHAN_VOICE, gi.soundindex (va("player/male/pain%i_%i.wav", l, r)), 1, ATTN_IDLE, 0);
  441. if (skill->value == 3)
  442. return; // no pain anims in nightmare
  443. // Don't go into pain frames if crucified.
  444. if (self->spawnflags & 8)
  445. {
  446. self->monsterinfo.currentmove = &insane_move_struggle_cross;
  447. return;
  448. }
  449. if ( ((self->s.frame >= FRAME_crawl1) && (self->s.frame <= FRAME_crawl9)) || ((self->s.frame >= FRAME_stand99) && (self->s.frame <= FRAME_stand160)) )
  450. {
  451. self->monsterinfo.currentmove = &insane_move_crawl_pain;
  452. }
  453. else
  454. self->monsterinfo.currentmove = &insane_move_stand_pain;
  455. }
  456. void insane_onground (edict_t *self)
  457. {
  458. self->monsterinfo.currentmove = &insane_move_down;
  459. }
  460. void insane_checkdown (edict_t *self)
  461. {
  462. // if ( (self->s.frame == FRAME_stand94) || (self->s.frame == FRAME_stand65) )
  463. if (self->spawnflags & 32) // Always stand
  464. return;
  465. if (random() < 0.3)
  466. if (random() < 0.5)
  467. self->monsterinfo.currentmove = &insane_move_uptodown;
  468. else
  469. self->monsterinfo.currentmove = &insane_move_jumpdown;
  470. }
  471. void insane_checkup (edict_t *self)
  472. {
  473. // If Hold_Ground and Crawl are set
  474. if ( (self->spawnflags & 4) && (self->spawnflags & 16) )
  475. return;
  476. if (random() < 0.5)
  477. self->monsterinfo.currentmove = &insane_move_downtoup;
  478. }
  479. void insane_stand (edict_t *self)
  480. {
  481. if (self->spawnflags & 8) // If crucified
  482. {
  483. self->monsterinfo.currentmove = &insane_move_cross;
  484. self->monsterinfo.aiflags |= AI_STAND_GROUND;
  485. }
  486. // If Hold_Ground and Crawl are set
  487. else if ( (self->spawnflags & 4) && (self->spawnflags & 16) )
  488. self->monsterinfo.currentmove = &insane_move_down;
  489. else
  490. if (random() < 0.5)
  491. self->monsterinfo.currentmove = &insane_move_stand_normal;
  492. else
  493. self->monsterinfo.currentmove = &insane_move_stand_insane;
  494. }
  495. void insane_dead (edict_t *self)
  496. {
  497. if (self->spawnflags & 8)
  498. {
  499. self->flags |= FL_FLY;
  500. }
  501. else
  502. {
  503. VectorSet (self->mins, -16, -16, -24);
  504. VectorSet (self->maxs, 16, 16, -8);
  505. self->movetype = MOVETYPE_TOSS;
  506. }
  507. self->svflags |= SVF_DEADMONSTER;
  508. self->nextthink = 0;
  509. gi.linkentity (self);
  510. }
  511. void insane_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point)
  512. {
  513. int n;
  514. if (self->health <= self->gib_health)
  515. {
  516. gi.sound (self, CHAN_VOICE, gi.soundindex ("misc/udeath.wav"), 1, ATTN_IDLE, 0);
  517. for (n= 0; n < 2; n++)
  518. ThrowGib (self, "models/objects/gibs/bone/tris.md2", damage, GIB_ORGANIC);
  519. for (n= 0; n < 4; n++)
  520. ThrowGib (self, "models/objects/gibs/sm_meat/tris.md2", damage, GIB_ORGANIC);
  521. ThrowHead (self, "models/objects/gibs/head2/tris.md2", damage, GIB_ORGANIC);
  522. self->deadflag = DEAD_DEAD;
  523. return;
  524. }
  525. if (self->deadflag == DEAD_DEAD)
  526. return;
  527. gi.sound (self, CHAN_VOICE, gi.soundindex(va("player/male/death%i.wav", (rand()%4)+1)), 1, ATTN_IDLE, 0);
  528. self->deadflag = DEAD_DEAD;
  529. self->takedamage = DAMAGE_YES;
  530. if (self->spawnflags & 8)
  531. {
  532. insane_dead (self);
  533. }
  534. else
  535. {
  536. if ( ((self->s.frame >= FRAME_crawl1) && (self->s.frame <= FRAME_crawl9)) || ((self->s.frame >= FRAME_stand99) && (self->s.frame <= FRAME_stand160)) )
  537. self->monsterinfo.currentmove = &insane_move_crawl_death;
  538. else
  539. self->monsterinfo.currentmove = &insane_move_stand_death;
  540. }
  541. }
  542. /*QUAKED misc_insane (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn CRAWL CRUCIFIED STAND_GROUND ALWAYS_STAND
  543. */
  544. void SP_misc_insane (edict_t *self)
  545. {
  546. // static int skin = 0; //@@
  547. if (deathmatch->value)
  548. {
  549. G_FreeEdict (self);
  550. return;
  551. }
  552. sound_fist = gi.soundindex ("insane/insane11.wav");
  553. sound_shake = gi.soundindex ("insane/insane5.wav");
  554. sound_moan = gi.soundindex ("insane/insane7.wav");
  555. sound_scream[0] = gi.soundindex ("insane/insane1.wav");
  556. sound_scream[1] = gi.soundindex ("insane/insane2.wav");
  557. sound_scream[2] = gi.soundindex ("insane/insane3.wav");
  558. sound_scream[3] = gi.soundindex ("insane/insane4.wav");
  559. sound_scream[4] = gi.soundindex ("insane/insane6.wav");
  560. sound_scream[5] = gi.soundindex ("insane/insane8.wav");
  561. sound_scream[6] = gi.soundindex ("insane/insane9.wav");
  562. sound_scream[7] = gi.soundindex ("insane/insane10.wav");
  563. self->movetype = MOVETYPE_STEP;
  564. self->solid = SOLID_BBOX;
  565. self->s.modelindex = gi.modelindex("models/monsters/insane/tris.md2");
  566. VectorSet (self->mins, -16, -16, -24);
  567. VectorSet (self->maxs, 16, 16, 32);
  568. self->health = 100;
  569. self->gib_health = -50;
  570. self->mass = 300;
  571. self->pain = insane_pain;
  572. self->die = insane_die;
  573. self->monsterinfo.stand = insane_stand;
  574. self->monsterinfo.walk = insane_walk;
  575. self->monsterinfo.run = insane_run;
  576. self->monsterinfo.dodge = NULL;
  577. self->monsterinfo.attack = NULL;
  578. self->monsterinfo.melee = NULL;
  579. self->monsterinfo.sight = NULL;
  580. self->monsterinfo.aiflags |= AI_GOOD_GUY;
  581. //@@
  582. // self->s.skinnum = skin;
  583. // skin++;
  584. // if (skin > 12)
  585. // skin = 0;
  586. gi.linkentity (self);
  587. if (self->spawnflags & 16) // Stand Ground
  588. self->monsterinfo.aiflags |= AI_STAND_GROUND;
  589. self->monsterinfo.currentmove = &insane_move_stand_normal;
  590. self->monsterinfo.scale = MODEL_SCALE;
  591. if (self->spawnflags & 8) // Crucified ?
  592. {
  593. VectorSet (self->mins, -16, 0, 0);
  594. VectorSet (self->maxs, 16, 8, 32);
  595. self->flags |= FL_NO_KNOCKBACK;
  596. flymonster_start (self);
  597. }
  598. else
  599. {
  600. walkmonster_start (self);
  601. self->s.skinnum = rand()%3;
  602. }
  603. }