m_float.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664
  1. /*
  2. Copyright (C) 1997-2001 Id Software, Inc.
  3. This program is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU General Public License
  5. as published by the Free Software Foundation; either version 2
  6. of the License, or (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. See the GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  14. */
  15. /*
  16. ==============================================================================
  17. floater
  18. ==============================================================================
  19. */
  20. #include "g_local.h"
  21. #include "m_float.h"
  22. static int sound_attack2;
  23. static int sound_attack3;
  24. static int sound_death1;
  25. static int sound_idle;
  26. static int sound_pain1;
  27. static int sound_pain2;
  28. static int sound_sight;
  29. void floater_sight (edict_t *self, edict_t *other)
  30. {
  31. gi.sound (self, CHAN_VOICE, sound_sight, 1, ATTN_NORM, 0);
  32. }
  33. void floater_idle (edict_t *self)
  34. {
  35. gi.sound (self, CHAN_VOICE, sound_idle, 1, ATTN_IDLE, 0);
  36. }
  37. //void floater_stand1 (edict_t *self);
  38. void floater_dead (edict_t *self);
  39. void floater_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point);
  40. void floater_run (edict_t *self);
  41. void floater_wham (edict_t *self);
  42. void floater_zap (edict_t *self);
  43. void floater_fire_blaster (edict_t *self)
  44. {
  45. vec3_t start;
  46. vec3_t forward, right;
  47. vec3_t end;
  48. vec3_t dir;
  49. int effect;
  50. if ((self->s.frame == FRAME_attak104) || (self->s.frame == FRAME_attak107))
  51. effect = EF_HYPERBLASTER;
  52. else
  53. effect = 0;
  54. AngleVectors (self->s.angles, forward, right, NULL);
  55. G_ProjectSource (self->s.origin, monster_flash_offset[MZ2_FLOAT_BLASTER_1], forward, right, start);
  56. VectorCopy (self->enemy->s.origin, end);
  57. end[2] += self->enemy->viewheight;
  58. VectorSubtract (end, start, dir);
  59. monster_fire_blaster (self, start, dir, 1, 1000, MZ2_FLOAT_BLASTER_1, effect);
  60. }
  61. mframe_t floater_frames_stand1 [] =
  62. {
  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. ai_stand, 0, NULL,
  104. ai_stand, 0, NULL,
  105. ai_stand, 0, NULL,
  106. ai_stand, 0, NULL,
  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. };
  116. mmove_t floater_move_stand1 = {FRAME_stand101, FRAME_stand152, floater_frames_stand1, NULL};
  117. mframe_t floater_frames_stand2 [] =
  118. {
  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. ai_stand, 0, NULL,
  160. ai_stand, 0, NULL,
  161. ai_stand, 0, NULL,
  162. ai_stand, 0, NULL,
  163. ai_stand, 0, NULL,
  164. ai_stand, 0, NULL,
  165. ai_stand, 0, NULL,
  166. ai_stand, 0, NULL,
  167. ai_stand, 0, NULL,
  168. ai_stand, 0, NULL,
  169. ai_stand, 0, NULL,
  170. ai_stand, 0, NULL
  171. };
  172. mmove_t floater_move_stand2 = {FRAME_stand201, FRAME_stand252, floater_frames_stand2, NULL};
  173. void floater_stand (edict_t *self)
  174. {
  175. if (random() <= 0.5)
  176. self->monsterinfo.currentmove = &floater_move_stand1;
  177. else
  178. self->monsterinfo.currentmove = &floater_move_stand2;
  179. }
  180. mframe_t floater_frames_activate [] =
  181. {
  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. 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. ai_move, 0, NULL,
  210. ai_move, 0, NULL,
  211. ai_move, 0, NULL
  212. };
  213. mmove_t floater_move_activate = {FRAME_actvat01, FRAME_actvat31, floater_frames_activate, NULL};
  214. mframe_t floater_frames_attack1 [] =
  215. {
  216. ai_charge, 0, NULL, // Blaster attack
  217. ai_charge, 0, NULL,
  218. ai_charge, 0, NULL,
  219. ai_charge, 0, floater_fire_blaster, // BOOM (0, -25.8, 32.5) -- LOOP Starts
  220. ai_charge, 0, floater_fire_blaster,
  221. ai_charge, 0, floater_fire_blaster,
  222. ai_charge, 0, floater_fire_blaster,
  223. ai_charge, 0, floater_fire_blaster,
  224. ai_charge, 0, floater_fire_blaster,
  225. ai_charge, 0, floater_fire_blaster,
  226. ai_charge, 0, NULL,
  227. ai_charge, 0, NULL,
  228. ai_charge, 0, NULL,
  229. ai_charge, 0, NULL // -- LOOP Ends
  230. };
  231. mmove_t floater_move_attack1 = {FRAME_attak101, FRAME_attak114, floater_frames_attack1, floater_run};
  232. mframe_t floater_frames_attack2 [] =
  233. {
  234. ai_charge, 0, NULL, // Claws
  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,
  241. ai_charge, 0, NULL,
  242. ai_charge, 0, NULL,
  243. ai_charge, 0, NULL,
  244. ai_charge, 0, NULL,
  245. ai_charge, 0, floater_wham, // WHAM (0, -45, 29.6) -- LOOP Starts
  246. ai_charge, 0, NULL,
  247. ai_charge, 0, NULL,
  248. ai_charge, 0, NULL,
  249. ai_charge, 0, NULL,
  250. ai_charge, 0, NULL,
  251. ai_charge, 0, NULL,
  252. ai_charge, 0, NULL, // -- LOOP Ends
  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. };
  260. mmove_t floater_move_attack2 = {FRAME_attak201, FRAME_attak225, floater_frames_attack2, floater_run};
  261. mframe_t floater_frames_attack3 [] =
  262. {
  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, floater_zap, // -- LOOP Starts
  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,
  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. ai_charge, 0, NULL,
  286. ai_charge, 0, NULL,
  287. ai_charge, 0, NULL,
  288. ai_charge, 0, NULL,
  289. ai_charge, 0, NULL,
  290. ai_charge, 0, NULL,
  291. ai_charge, 0, NULL, // -- LOOP Ends
  292. ai_charge, 0, NULL,
  293. ai_charge, 0, NULL,
  294. ai_charge, 0, NULL,
  295. ai_charge, 0, NULL,
  296. ai_charge, 0, NULL
  297. };
  298. mmove_t floater_move_attack3 = {FRAME_attak301, FRAME_attak334, floater_frames_attack3, floater_run};
  299. mframe_t floater_frames_death [] =
  300. {
  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. };
  315. mmove_t floater_move_death = {FRAME_death01, FRAME_death13, floater_frames_death, floater_dead};
  316. mframe_t floater_frames_pain1 [] =
  317. {
  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_pain1 = {FRAME_pain101, FRAME_pain107, floater_frames_pain1, floater_run};
  327. mframe_t floater_frames_pain2 [] =
  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. };
  338. mmove_t floater_move_pain2 = {FRAME_pain201, FRAME_pain208, floater_frames_pain2, floater_run};
  339. mframe_t floater_frames_pain3 [] =
  340. {
  341. ai_move, 0, NULL,
  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. };
  354. mmove_t floater_move_pain3 = {FRAME_pain301, FRAME_pain312, floater_frames_pain3, floater_run};
  355. mframe_t floater_frames_walk [] =
  356. {
  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. ai_walk, 5, NULL,
  398. ai_walk, 5, NULL,
  399. ai_walk, 5, NULL,
  400. ai_walk, 5, NULL,
  401. ai_walk, 5, NULL,
  402. ai_walk, 5, NULL,
  403. ai_walk, 5, NULL,
  404. ai_walk, 5, NULL,
  405. ai_walk, 5, NULL,
  406. ai_walk, 5, NULL,
  407. ai_walk, 5, NULL,
  408. ai_walk, 5, NULL
  409. };
  410. mmove_t floater_move_walk = {FRAME_stand101, FRAME_stand152, floater_frames_walk, NULL};
  411. mframe_t floater_frames_run [] =
  412. {
  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. ai_run, 13, NULL,
  454. ai_run, 13, NULL,
  455. ai_run, 13, NULL,
  456. ai_run, 13, NULL,
  457. ai_run, 13, NULL,
  458. ai_run, 13, NULL,
  459. ai_run, 13, NULL,
  460. ai_run, 13, NULL,
  461. ai_run, 13, NULL,
  462. ai_run, 13, NULL,
  463. ai_run, 13, NULL,
  464. ai_run, 13, NULL
  465. };
  466. mmove_t floater_move_run = {FRAME_stand101, FRAME_stand152, floater_frames_run, NULL};
  467. void floater_run (edict_t *self)
  468. {
  469. if (self->monsterinfo.aiflags & AI_STAND_GROUND)
  470. self->monsterinfo.currentmove = &floater_move_stand1;
  471. else
  472. self->monsterinfo.currentmove = &floater_move_run;
  473. }
  474. void floater_walk (edict_t *self)
  475. {
  476. self->monsterinfo.currentmove = &floater_move_walk;
  477. }
  478. void floater_wham (edict_t *self)
  479. {
  480. static vec3_t aim = {MELEE_DISTANCE, 0, 0};
  481. gi.sound (self, CHAN_WEAPON, sound_attack3, 1, ATTN_NORM, 0);
  482. fire_hit (self, aim, 5 + rand() % 6, -50);
  483. }
  484. void floater_zap (edict_t *self)
  485. {
  486. vec3_t forward, right;
  487. vec3_t origin;
  488. vec3_t dir;
  489. vec3_t offset;
  490. VectorSubtract (self->enemy->s.origin, self->s.origin, dir);
  491. AngleVectors (self->s.angles, forward, right, NULL);
  492. //FIXME use a flash and replace these two lines with the commented one
  493. VectorSet (offset, 18.5, -0.9, 10);
  494. G_ProjectSource (self->s.origin, offset, forward, right, origin);
  495. // G_ProjectSource (self->s.origin, monster_flash_offset[flash_number], forward, right, origin);
  496. gi.sound (self, CHAN_WEAPON, sound_attack2, 1, ATTN_NORM, 0);
  497. //FIXME use the flash, Luke
  498. gi.WriteByte (svc_temp_entity);
  499. gi.WriteByte (TE_SPLASH);
  500. gi.WriteByte (32);
  501. gi.WritePosition (origin);
  502. gi.WriteDir (dir);
  503. gi.WriteByte (1); //sparks
  504. gi.multicast (origin, MULTICAST_PVS);
  505. T_Damage (self->enemy, self, self, dir, self->enemy->s.origin, vec3_origin, 5 + rand() % 6, -10, DAMAGE_ENERGY, MOD_UNKNOWN);
  506. }
  507. void floater_attack(edict_t *self)
  508. {
  509. self->monsterinfo.currentmove = &floater_move_attack1;
  510. }
  511. void floater_melee(edict_t *self)
  512. {
  513. if (random() < 0.5)
  514. self->monsterinfo.currentmove = &floater_move_attack3;
  515. else
  516. self->monsterinfo.currentmove = &floater_move_attack2;
  517. }
  518. void floater_pain (edict_t *self, edict_t *other, float kick, int damage)
  519. {
  520. int n;
  521. if (self->health < (self->max_health / 2))
  522. self->s.skinnum = 1;
  523. if (level.time < self->pain_debounce_time)
  524. return;
  525. self->pain_debounce_time = level.time + 3;
  526. if (skill->value == 3)
  527. return; // no pain anims in nightmare
  528. n = (rand() + 1) % 3;
  529. if (n == 0)
  530. {
  531. gi.sound (self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0);
  532. self->monsterinfo.currentmove = &floater_move_pain1;
  533. }
  534. else
  535. {
  536. gi.sound (self, CHAN_VOICE, sound_pain2, 1, ATTN_NORM, 0);
  537. self->monsterinfo.currentmove = &floater_move_pain2;
  538. }
  539. }
  540. void floater_dead (edict_t *self)
  541. {
  542. VectorSet (self->mins, -16, -16, -24);
  543. VectorSet (self->maxs, 16, 16, -8);
  544. self->movetype = MOVETYPE_TOSS;
  545. self->svflags |= SVF_DEADMONSTER;
  546. self->nextthink = 0;
  547. gi.linkentity (self);
  548. }
  549. void floater_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point)
  550. {
  551. gi.sound (self, CHAN_VOICE, sound_death1, 1, ATTN_NORM, 0);
  552. BecomeExplosion1(self);
  553. }
  554. /*QUAKED monster_floater (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn Sight
  555. */
  556. void SP_monster_floater (edict_t *self)
  557. {
  558. if (deathmatch->value)
  559. {
  560. G_FreeEdict (self);
  561. return;
  562. }
  563. sound_attack2 = gi.soundindex ("floater/fltatck2.wav");
  564. sound_attack3 = gi.soundindex ("floater/fltatck3.wav");
  565. sound_death1 = gi.soundindex ("floater/fltdeth1.wav");
  566. sound_idle = gi.soundindex ("floater/fltidle1.wav");
  567. sound_pain1 = gi.soundindex ("floater/fltpain1.wav");
  568. sound_pain2 = gi.soundindex ("floater/fltpain2.wav");
  569. sound_sight = gi.soundindex ("floater/fltsght1.wav");
  570. gi.soundindex ("floater/fltatck1.wav");
  571. self->s.sound = gi.soundindex ("floater/fltsrch1.wav");
  572. self->movetype = MOVETYPE_STEP;
  573. self->solid = SOLID_BBOX;
  574. self->s.modelindex = gi.modelindex ("models/monsters/float/tris.md2");
  575. VectorSet (self->mins, -24, -24, -24);
  576. VectorSet (self->maxs, 24, 24, 32);
  577. self->health = 200;
  578. self->gib_health = -80;
  579. self->mass = 300;
  580. self->pain = floater_pain;
  581. self->die = floater_die;
  582. self->monsterinfo.stand = floater_stand;
  583. self->monsterinfo.walk = floater_walk;
  584. self->monsterinfo.run = floater_run;
  585. // self->monsterinfo.dodge = floater_dodge;
  586. self->monsterinfo.attack = floater_attack;
  587. self->monsterinfo.melee = floater_melee;
  588. self->monsterinfo.sight = floater_sight;
  589. self->monsterinfo.idle = floater_idle;
  590. gi.linkentity (self);
  591. if (random() <= 0.5)
  592. self->monsterinfo.currentmove = &floater_move_stand1;
  593. else
  594. self->monsterinfo.currentmove = &floater_move_stand2;
  595. self->monsterinfo.scale = MODEL_SCALE;
  596. flymonster_start (self);
  597. }