m_float.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647
  1. // Copyright (c) ZeniMax Media Inc.
  2. // Licensed under the GNU General Public License 2.0.
  3. /*
  4. ==============================================================================
  5. floater
  6. ==============================================================================
  7. */
  8. #include "g_local.h"
  9. #include "m_float.h"
  10. static int sound_attack2;
  11. static int sound_attack3;
  12. static int sound_death1;
  13. static int sound_idle;
  14. static int sound_pain1;
  15. static int sound_pain2;
  16. static int sound_sight;
  17. void floater_sight (edict_t *self, edict_t *other)
  18. {
  19. gi.sound (self, CHAN_VOICE, sound_sight, 1, ATTN_NORM, 0);
  20. }
  21. void floater_idle (edict_t *self)
  22. {
  23. gi.sound (self, CHAN_VOICE, sound_idle, 1, ATTN_IDLE, 0);
  24. }
  25. //void floater_stand1 (edict_t *self);
  26. void floater_dead (edict_t *self);
  27. void floater_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point);
  28. void floater_run (edict_t *self);
  29. void floater_wham (edict_t *self);
  30. void floater_zap (edict_t *self);
  31. void floater_fire_blaster (edict_t *self)
  32. {
  33. vec3_t start;
  34. vec3_t forward, right;
  35. vec3_t end;
  36. vec3_t dir;
  37. int effect;
  38. if ((self->s.frame == FRAME_attak104) || (self->s.frame == FRAME_attak107))
  39. effect = EF_HYPERBLASTER;
  40. else
  41. effect = 0;
  42. AngleVectors (self->s.angles, forward, right, NULL);
  43. G_ProjectSource (self->s.origin, monster_flash_offset[MZ2_FLOAT_BLASTER_1], forward, right, start);
  44. VectorCopy (self->enemy->s.origin, end);
  45. end[2] += self->enemy->viewheight;
  46. VectorSubtract (end, start, dir);
  47. monster_fire_blaster (self, start, dir, 1, 1000, MZ2_FLOAT_BLASTER_1, effect);
  48. }
  49. mframe_t floater_frames_stand1 [] =
  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. };
  104. mmove_t floater_move_stand1 = {FRAME_stand101, FRAME_stand152, floater_frames_stand1, NULL};
  105. mframe_t floater_frames_stand2 [] =
  106. {
  107. ai_stand, 0, NULL,
  108. ai_stand, 0, NULL,
  109. ai_stand, 0, NULL,
  110. ai_stand, 0, NULL,
  111. ai_stand, 0, NULL,
  112. ai_stand, 0, NULL,
  113. ai_stand, 0, NULL,
  114. ai_stand, 0, NULL,
  115. ai_stand, 0, NULL,
  116. ai_stand, 0, NULL,
  117. ai_stand, 0, NULL,
  118. ai_stand, 0, NULL,
  119. ai_stand, 0, NULL,
  120. ai_stand, 0, NULL,
  121. ai_stand, 0, NULL,
  122. ai_stand, 0, NULL,
  123. ai_stand, 0, NULL,
  124. ai_stand, 0, NULL,
  125. ai_stand, 0, NULL,
  126. ai_stand, 0, NULL,
  127. ai_stand, 0, NULL,
  128. ai_stand, 0, NULL,
  129. ai_stand, 0, NULL,
  130. ai_stand, 0, NULL,
  131. ai_stand, 0, NULL,
  132. ai_stand, 0, NULL,
  133. ai_stand, 0, NULL,
  134. ai_stand, 0, NULL,
  135. ai_stand, 0, NULL,
  136. ai_stand, 0, NULL,
  137. ai_stand, 0, NULL,
  138. ai_stand, 0, NULL,
  139. ai_stand, 0, NULL,
  140. ai_stand, 0, NULL,
  141. ai_stand, 0, NULL,
  142. ai_stand, 0, NULL,
  143. ai_stand, 0, NULL,
  144. ai_stand, 0, NULL,
  145. ai_stand, 0, NULL,
  146. ai_stand, 0, NULL,
  147. ai_stand, 0, NULL,
  148. ai_stand, 0, NULL,
  149. ai_stand, 0, NULL,
  150. ai_stand, 0, NULL,
  151. ai_stand, 0, NULL,
  152. ai_stand, 0, NULL,
  153. ai_stand, 0, NULL,
  154. ai_stand, 0, NULL,
  155. ai_stand, 0, NULL,
  156. ai_stand, 0, NULL,
  157. ai_stand, 0, NULL,
  158. ai_stand, 0, NULL
  159. };
  160. mmove_t floater_move_stand2 = {FRAME_stand201, FRAME_stand252, floater_frames_stand2, NULL};
  161. void floater_stand (edict_t *self)
  162. {
  163. if (random() <= 0.5)
  164. self->monsterinfo.currentmove = &floater_move_stand1;
  165. else
  166. self->monsterinfo.currentmove = &floater_move_stand2;
  167. }
  168. mframe_t floater_frames_activate [] =
  169. {
  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. 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. ai_move, 0, NULL
  200. };
  201. mmove_t floater_move_activate = {FRAME_actvat01, FRAME_actvat31, floater_frames_activate, NULL};
  202. mframe_t floater_frames_attack1 [] =
  203. {
  204. ai_charge, 0, NULL, // Blaster attack
  205. ai_charge, 0, NULL,
  206. ai_charge, 0, NULL,
  207. ai_charge, 0, floater_fire_blaster, // BOOM (0, -25.8, 32.5) -- LOOP Starts
  208. ai_charge, 0, floater_fire_blaster,
  209. ai_charge, 0, floater_fire_blaster,
  210. ai_charge, 0, floater_fire_blaster,
  211. ai_charge, 0, floater_fire_blaster,
  212. ai_charge, 0, floater_fire_blaster,
  213. ai_charge, 0, floater_fire_blaster,
  214. ai_charge, 0, NULL,
  215. ai_charge, 0, NULL,
  216. ai_charge, 0, NULL,
  217. ai_charge, 0, NULL // -- LOOP Ends
  218. };
  219. mmove_t floater_move_attack1 = {FRAME_attak101, FRAME_attak114, floater_frames_attack1, floater_run};
  220. mframe_t floater_frames_attack2 [] =
  221. {
  222. ai_charge, 0, NULL, // Claws
  223. ai_charge, 0, NULL,
  224. ai_charge, 0, NULL,
  225. ai_charge, 0, NULL,
  226. ai_charge, 0, NULL,
  227. ai_charge, 0, NULL,
  228. ai_charge, 0, NULL,
  229. ai_charge, 0, NULL,
  230. ai_charge, 0, NULL,
  231. ai_charge, 0, NULL,
  232. ai_charge, 0, NULL,
  233. ai_charge, 0, floater_wham, // WHAM (0, -45, 29.6) -- LOOP Starts
  234. ai_charge, 0, NULL,
  235. ai_charge, 0, NULL,
  236. ai_charge, 0, NULL,
  237. ai_charge, 0, NULL,
  238. ai_charge, 0, NULL,
  239. ai_charge, 0, NULL,
  240. ai_charge, 0, NULL, // -- LOOP Ends
  241. ai_charge, 0, NULL,
  242. ai_charge, 0, NULL,
  243. ai_charge, 0, NULL,
  244. ai_charge, 0, NULL,
  245. ai_charge, 0, NULL,
  246. ai_charge, 0, NULL
  247. };
  248. mmove_t floater_move_attack2 = {FRAME_attak201, FRAME_attak225, floater_frames_attack2, floater_run};
  249. mframe_t floater_frames_attack3 [] =
  250. {
  251. ai_charge, 0, NULL,
  252. ai_charge, 0, NULL,
  253. ai_charge, 0, NULL,
  254. ai_charge, 0, NULL,
  255. ai_charge, 0, NULL,
  256. ai_charge, 0, NULL,
  257. ai_charge, 0, NULL,
  258. ai_charge, 0, NULL,
  259. ai_charge, 0, floater_zap, // -- LOOP Starts
  260. ai_charge, 0, NULL,
  261. ai_charge, 0, NULL,
  262. ai_charge, 0, NULL,
  263. ai_charge, 0, NULL,
  264. ai_charge, 0, NULL,
  265. ai_charge, 0, NULL,
  266. ai_charge, 0, NULL,
  267. ai_charge, 0, NULL,
  268. ai_charge, 0, NULL,
  269. ai_charge, 0, NULL,
  270. ai_charge, 0, NULL,
  271. ai_charge, 0, NULL,
  272. ai_charge, 0, NULL,
  273. ai_charge, 0, NULL,
  274. ai_charge, 0, NULL,
  275. ai_charge, 0, NULL,
  276. ai_charge, 0, NULL,
  277. ai_charge, 0, NULL,
  278. ai_charge, 0, NULL,
  279. ai_charge, 0, NULL, // -- LOOP Ends
  280. ai_charge, 0, NULL,
  281. ai_charge, 0, NULL,
  282. ai_charge, 0, NULL,
  283. ai_charge, 0, NULL,
  284. ai_charge, 0, NULL
  285. };
  286. mmove_t floater_move_attack3 = {FRAME_attak301, FRAME_attak334, floater_frames_attack3, floater_run};
  287. mframe_t floater_frames_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. };
  303. mmove_t floater_move_death = {FRAME_death01, FRAME_death13, floater_frames_death, floater_dead};
  304. mframe_t floater_frames_pain1 [] =
  305. {
  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. };
  314. mmove_t floater_move_pain1 = {FRAME_pain101, FRAME_pain107, floater_frames_pain1, floater_run};
  315. mframe_t floater_frames_pain2 [] =
  316. {
  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. };
  326. mmove_t floater_move_pain2 = {FRAME_pain201, FRAME_pain208, floater_frames_pain2, floater_run};
  327. mframe_t floater_frames_pain3 [] =
  328. {
  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. ai_move, 0, NULL,
  337. ai_move, 0, NULL,
  338. ai_move, 0, NULL,
  339. ai_move, 0, NULL,
  340. ai_move, 0, NULL
  341. };
  342. mmove_t floater_move_pain3 = {FRAME_pain301, FRAME_pain312, floater_frames_pain3, floater_run};
  343. mframe_t floater_frames_walk [] =
  344. {
  345. ai_walk, 5, NULL,
  346. ai_walk, 5, NULL,
  347. ai_walk, 5, NULL,
  348. ai_walk, 5, NULL,
  349. ai_walk, 5, NULL,
  350. ai_walk, 5, NULL,
  351. ai_walk, 5, NULL,
  352. ai_walk, 5, NULL,
  353. ai_walk, 5, NULL,
  354. ai_walk, 5, NULL,
  355. ai_walk, 5, NULL,
  356. ai_walk, 5, NULL,
  357. ai_walk, 5, NULL,
  358. ai_walk, 5, NULL,
  359. ai_walk, 5, NULL,
  360. ai_walk, 5, NULL,
  361. ai_walk, 5, NULL,
  362. ai_walk, 5, NULL,
  363. ai_walk, 5, NULL,
  364. ai_walk, 5, NULL,
  365. ai_walk, 5, NULL,
  366. ai_walk, 5, NULL,
  367. ai_walk, 5, NULL,
  368. ai_walk, 5, NULL,
  369. ai_walk, 5, NULL,
  370. ai_walk, 5, NULL,
  371. ai_walk, 5, NULL,
  372. ai_walk, 5, NULL,
  373. ai_walk, 5, NULL,
  374. ai_walk, 5, NULL,
  375. ai_walk, 5, NULL,
  376. ai_walk, 5, NULL,
  377. ai_walk, 5, NULL,
  378. ai_walk, 5, NULL,
  379. ai_walk, 5, NULL,
  380. ai_walk, 5, NULL,
  381. ai_walk, 5, NULL,
  382. ai_walk, 5, NULL,
  383. ai_walk, 5, NULL,
  384. ai_walk, 5, NULL,
  385. ai_walk, 5, NULL,
  386. ai_walk, 5, NULL,
  387. ai_walk, 5, NULL,
  388. ai_walk, 5, NULL,
  389. ai_walk, 5, NULL,
  390. ai_walk, 5, NULL,
  391. ai_walk, 5, NULL,
  392. ai_walk, 5, NULL,
  393. ai_walk, 5, NULL,
  394. ai_walk, 5, NULL,
  395. ai_walk, 5, NULL,
  396. ai_walk, 5, NULL
  397. };
  398. mmove_t floater_move_walk = {FRAME_stand101, FRAME_stand152, floater_frames_walk, NULL};
  399. mframe_t floater_frames_run [] =
  400. {
  401. ai_run, 13, NULL,
  402. ai_run, 13, NULL,
  403. ai_run, 13, NULL,
  404. ai_run, 13, NULL,
  405. ai_run, 13, NULL,
  406. ai_run, 13, NULL,
  407. ai_run, 13, NULL,
  408. ai_run, 13, NULL,
  409. ai_run, 13, NULL,
  410. ai_run, 13, NULL,
  411. ai_run, 13, NULL,
  412. ai_run, 13, NULL,
  413. ai_run, 13, NULL,
  414. ai_run, 13, NULL,
  415. ai_run, 13, NULL,
  416. ai_run, 13, NULL,
  417. ai_run, 13, NULL,
  418. ai_run, 13, NULL,
  419. ai_run, 13, NULL,
  420. ai_run, 13, NULL,
  421. ai_run, 13, NULL,
  422. ai_run, 13, NULL,
  423. ai_run, 13, NULL,
  424. ai_run, 13, NULL,
  425. ai_run, 13, NULL,
  426. ai_run, 13, NULL,
  427. ai_run, 13, NULL,
  428. ai_run, 13, NULL,
  429. ai_run, 13, NULL,
  430. ai_run, 13, NULL,
  431. ai_run, 13, NULL,
  432. ai_run, 13, NULL,
  433. ai_run, 13, NULL,
  434. ai_run, 13, NULL,
  435. ai_run, 13, NULL,
  436. ai_run, 13, NULL,
  437. ai_run, 13, NULL,
  438. ai_run, 13, NULL,
  439. ai_run, 13, NULL,
  440. ai_run, 13, NULL,
  441. ai_run, 13, NULL,
  442. ai_run, 13, NULL,
  443. ai_run, 13, NULL,
  444. ai_run, 13, NULL,
  445. ai_run, 13, NULL,
  446. ai_run, 13, NULL,
  447. ai_run, 13, NULL,
  448. ai_run, 13, NULL,
  449. ai_run, 13, NULL,
  450. ai_run, 13, NULL,
  451. ai_run, 13, NULL,
  452. ai_run, 13, NULL
  453. };
  454. mmove_t floater_move_run = {FRAME_stand101, FRAME_stand152, floater_frames_run, NULL};
  455. void floater_run (edict_t *self)
  456. {
  457. if (self->monsterinfo.aiflags & AI_STAND_GROUND)
  458. self->monsterinfo.currentmove = &floater_move_stand1;
  459. else
  460. self->monsterinfo.currentmove = &floater_move_run;
  461. }
  462. void floater_walk (edict_t *self)
  463. {
  464. self->monsterinfo.currentmove = &floater_move_walk;
  465. }
  466. void floater_wham (edict_t *self)
  467. {
  468. static vec3_t aim = {MELEE_DISTANCE, 0, 0};
  469. gi.sound (self, CHAN_WEAPON, sound_attack3, 1, ATTN_NORM, 0);
  470. fire_hit (self, aim, 5 + rand() % 6, -50);
  471. }
  472. void floater_zap (edict_t *self)
  473. {
  474. vec3_t forward, right;
  475. vec3_t origin;
  476. vec3_t dir;
  477. vec3_t offset;
  478. VectorSubtract (self->enemy->s.origin, self->s.origin, dir);
  479. AngleVectors (self->s.angles, forward, right, NULL);
  480. //FIXME use a flash and replace these two lines with the commented one
  481. VectorSet (offset, 18.5, -0.9, 10);
  482. G_ProjectSource (self->s.origin, offset, forward, right, origin);
  483. // G_ProjectSource (self->s.origin, monster_flash_offset[flash_number], forward, right, origin);
  484. gi.sound (self, CHAN_WEAPON, sound_attack2, 1, ATTN_NORM, 0);
  485. //FIXME use the flash, Luke
  486. gi.WriteByte (svc_temp_entity);
  487. gi.WriteByte (TE_SPLASH);
  488. gi.WriteByte (32);
  489. gi.WritePosition (origin);
  490. gi.WriteDir (dir);
  491. gi.WriteByte (1); //sparks
  492. gi.multicast (origin, MULTICAST_PVS);
  493. T_Damage (self->enemy, self, self, dir, self->enemy->s.origin, vec3_origin, 5 + rand() % 6, -10, DAMAGE_ENERGY, MOD_UNKNOWN);
  494. }
  495. void floater_attack(edict_t *self)
  496. {
  497. self->monsterinfo.currentmove = &floater_move_attack1;
  498. }
  499. void floater_melee(edict_t *self)
  500. {
  501. if (random() < 0.5)
  502. self->monsterinfo.currentmove = &floater_move_attack3;
  503. else
  504. self->monsterinfo.currentmove = &floater_move_attack2;
  505. }
  506. void floater_pain (edict_t *self, edict_t *other, float kick, int damage)
  507. {
  508. int n;
  509. if (self->health < (self->max_health / 2))
  510. self->s.skinnum = 1;
  511. if (level.time < self->pain_debounce_time)
  512. return;
  513. self->pain_debounce_time = level.time + 3;
  514. if (skill->value == 3)
  515. return; // no pain anims in nightmare
  516. n = (rand() + 1) % 3;
  517. if (n == 0)
  518. {
  519. gi.sound (self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0);
  520. self->monsterinfo.currentmove = &floater_move_pain1;
  521. }
  522. else
  523. {
  524. gi.sound (self, CHAN_VOICE, sound_pain2, 1, ATTN_NORM, 0);
  525. self->monsterinfo.currentmove = &floater_move_pain2;
  526. }
  527. }
  528. void floater_dead (edict_t *self)
  529. {
  530. VectorSet (self->mins, -16, -16, -24);
  531. VectorSet (self->maxs, 16, 16, -8);
  532. self->movetype = MOVETYPE_TOSS;
  533. self->svflags |= SVF_DEADMONSTER;
  534. self->nextthink = 0;
  535. gi.linkentity (self);
  536. }
  537. void floater_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point)
  538. {
  539. gi.sound (self, CHAN_VOICE, sound_death1, 1, ATTN_NORM, 0);
  540. BecomeExplosion1(self);
  541. }
  542. /*QUAKED monster_floater (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn Sight
  543. */
  544. void SP_monster_floater (edict_t *self)
  545. {
  546. if (deathmatch->value)
  547. {
  548. G_FreeEdict (self);
  549. return;
  550. }
  551. sound_attack2 = gi.soundindex ("floater/fltatck2.wav");
  552. sound_attack3 = gi.soundindex ("floater/fltatck3.wav");
  553. sound_death1 = gi.soundindex ("floater/fltdeth1.wav");
  554. sound_idle = gi.soundindex ("floater/fltidle1.wav");
  555. sound_pain1 = gi.soundindex ("floater/fltpain1.wav");
  556. sound_pain2 = gi.soundindex ("floater/fltpain2.wav");
  557. sound_sight = gi.soundindex ("floater/fltsght1.wav");
  558. gi.soundindex ("floater/fltatck1.wav");
  559. self->s.sound = gi.soundindex ("floater/fltsrch1.wav");
  560. self->movetype = MOVETYPE_STEP;
  561. self->solid = SOLID_BBOX;
  562. self->s.modelindex = gi.modelindex ("models/monsters/float/tris.md2");
  563. VectorSet (self->mins, -24, -24, -24);
  564. VectorSet (self->maxs, 24, 24, 32);
  565. self->health = 200;
  566. self->gib_health = -80;
  567. self->mass = 300;
  568. self->pain = floater_pain;
  569. self->die = floater_die;
  570. self->monsterinfo.stand = floater_stand;
  571. self->monsterinfo.walk = floater_walk;
  572. self->monsterinfo.run = floater_run;
  573. // self->monsterinfo.dodge = floater_dodge;
  574. self->monsterinfo.attack = floater_attack;
  575. self->monsterinfo.melee = floater_melee;
  576. self->monsterinfo.sight = floater_sight;
  577. self->monsterinfo.idle = floater_idle;
  578. gi.linkentity (self);
  579. if (random() <= 0.5)
  580. self->monsterinfo.currentmove = &floater_move_stand1;
  581. else
  582. self->monsterinfo.currentmove = &floater_move_stand2;
  583. self->monsterinfo.scale = MODEL_SCALE;
  584. flymonster_start (self);
  585. }