m_soldier.c 28 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300
  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. SOLDIER
  18. ==============================================================================
  19. */
  20. #include "g_local.h"
  21. #include "m_soldier.h"
  22. static int sound_idle;
  23. static int sound_sight1;
  24. static int sound_sight2;
  25. static int sound_pain_light;
  26. static int sound_pain;
  27. static int sound_pain_ss;
  28. static int sound_death_light;
  29. static int sound_death;
  30. static int sound_death_ss;
  31. static int sound_cock;
  32. void soldier_idle (edict_t *self)
  33. {
  34. if (random() > 0.8)
  35. gi.sound (self, CHAN_VOICE, sound_idle, 1, ATTN_IDLE, 0);
  36. }
  37. void soldier_cock (edict_t *self)
  38. {
  39. if (self->s.frame == FRAME_stand322)
  40. gi.sound (self, CHAN_WEAPON, sound_cock, 1, ATTN_IDLE, 0);
  41. else
  42. gi.sound (self, CHAN_WEAPON, sound_cock, 1, ATTN_NORM, 0);
  43. }
  44. // STAND
  45. void soldier_stand (edict_t *self);
  46. mframe_t soldier_frames_stand1 [] =
  47. {
  48. ai_stand, 0, soldier_idle,
  49. ai_stand, 0, NULL,
  50. ai_stand, 0, NULL,
  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. };
  79. mmove_t soldier_move_stand1 = {FRAME_stand101, FRAME_stand130, soldier_frames_stand1, soldier_stand};
  80. mframe_t soldier_frames_stand3 [] =
  81. {
  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, soldier_cock,
  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. 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. };
  122. mmove_t soldier_move_stand3 = {FRAME_stand301, FRAME_stand339, soldier_frames_stand3, soldier_stand};
  123. #if 0
  124. mframe_t soldier_frames_stand4 [] =
  125. {
  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. ai_stand, 0, NULL,
  172. ai_stand, 4, NULL,
  173. ai_stand, 1, NULL,
  174. ai_stand, -1, NULL,
  175. ai_stand, -2, NULL,
  176. ai_stand, 0, NULL,
  177. ai_stand, 0, NULL
  178. };
  179. mmove_t soldier_move_stand4 = {FRAME_stand401, FRAME_stand452, soldier_frames_stand4, NULL};
  180. #endif
  181. void soldier_stand (edict_t *self)
  182. {
  183. if ((self->monsterinfo.currentmove == &soldier_move_stand3) || (random() < 0.8))
  184. self->monsterinfo.currentmove = &soldier_move_stand1;
  185. else
  186. self->monsterinfo.currentmove = &soldier_move_stand3;
  187. }
  188. //
  189. // WALK
  190. //
  191. void soldier_walk1_random (edict_t *self)
  192. {
  193. if (random() > 0.1)
  194. self->monsterinfo.nextframe = FRAME_walk101;
  195. }
  196. mframe_t soldier_frames_walk1 [] =
  197. {
  198. ai_walk, 3, NULL,
  199. ai_walk, 6, NULL,
  200. ai_walk, 2, NULL,
  201. ai_walk, 2, NULL,
  202. ai_walk, 2, NULL,
  203. ai_walk, 1, NULL,
  204. ai_walk, 6, NULL,
  205. ai_walk, 5, NULL,
  206. ai_walk, 3, NULL,
  207. ai_walk, -1, soldier_walk1_random,
  208. ai_walk, 0, NULL,
  209. ai_walk, 0, NULL,
  210. ai_walk, 0, NULL,
  211. ai_walk, 0, NULL,
  212. ai_walk, 0, NULL,
  213. ai_walk, 0, NULL,
  214. ai_walk, 0, NULL,
  215. ai_walk, 0, NULL,
  216. ai_walk, 0, NULL,
  217. ai_walk, 0, NULL,
  218. ai_walk, 0, NULL,
  219. ai_walk, 0, NULL,
  220. ai_walk, 0, NULL,
  221. ai_walk, 0, NULL,
  222. ai_walk, 0, NULL,
  223. ai_walk, 0, NULL,
  224. ai_walk, 0, NULL,
  225. ai_walk, 0, NULL,
  226. ai_walk, 0, NULL,
  227. ai_walk, 0, NULL,
  228. ai_walk, 0, NULL,
  229. ai_walk, 0, NULL,
  230. ai_walk, 0, NULL
  231. };
  232. mmove_t soldier_move_walk1 = {FRAME_walk101, FRAME_walk133, soldier_frames_walk1, NULL};
  233. mframe_t soldier_frames_walk2 [] =
  234. {
  235. ai_walk, 4, NULL,
  236. ai_walk, 4, NULL,
  237. ai_walk, 9, NULL,
  238. ai_walk, 8, NULL,
  239. ai_walk, 5, NULL,
  240. ai_walk, 1, NULL,
  241. ai_walk, 3, NULL,
  242. ai_walk, 7, NULL,
  243. ai_walk, 6, NULL,
  244. ai_walk, 7, NULL
  245. };
  246. mmove_t soldier_move_walk2 = {FRAME_walk209, FRAME_walk218, soldier_frames_walk2, NULL};
  247. void soldier_walk (edict_t *self)
  248. {
  249. if (random() < 0.5)
  250. self->monsterinfo.currentmove = &soldier_move_walk1;
  251. else
  252. self->monsterinfo.currentmove = &soldier_move_walk2;
  253. }
  254. //
  255. // RUN
  256. //
  257. void soldier_run (edict_t *self);
  258. mframe_t soldier_frames_start_run [] =
  259. {
  260. ai_run, 7, NULL,
  261. ai_run, 5, NULL
  262. };
  263. mmove_t soldier_move_start_run = {FRAME_run01, FRAME_run02, soldier_frames_start_run, soldier_run};
  264. mframe_t soldier_frames_run [] =
  265. {
  266. ai_run, 10, NULL,
  267. ai_run, 11, NULL,
  268. ai_run, 11, NULL,
  269. ai_run, 16, NULL,
  270. ai_run, 10, NULL,
  271. ai_run, 15, NULL
  272. };
  273. mmove_t soldier_move_run = {FRAME_run03, FRAME_run08, soldier_frames_run, NULL};
  274. void soldier_run (edict_t *self)
  275. {
  276. if (self->monsterinfo.aiflags & AI_STAND_GROUND)
  277. {
  278. self->monsterinfo.currentmove = &soldier_move_stand1;
  279. return;
  280. }
  281. if (self->monsterinfo.currentmove == &soldier_move_walk1 ||
  282. self->monsterinfo.currentmove == &soldier_move_walk2 ||
  283. self->monsterinfo.currentmove == &soldier_move_start_run)
  284. {
  285. self->monsterinfo.currentmove = &soldier_move_run;
  286. }
  287. else
  288. {
  289. self->monsterinfo.currentmove = &soldier_move_start_run;
  290. }
  291. }
  292. //
  293. // PAIN
  294. //
  295. mframe_t soldier_frames_pain1 [] =
  296. {
  297. ai_move, -3, NULL,
  298. ai_move, 4, NULL,
  299. ai_move, 1, NULL,
  300. ai_move, 1, NULL,
  301. ai_move, 0, NULL
  302. };
  303. mmove_t soldier_move_pain1 = {FRAME_pain101, FRAME_pain105, soldier_frames_pain1, soldier_run};
  304. mframe_t soldier_frames_pain2 [] =
  305. {
  306. ai_move, -13, NULL,
  307. ai_move, -1, NULL,
  308. ai_move, 2, NULL,
  309. ai_move, 4, NULL,
  310. ai_move, 2, NULL,
  311. ai_move, 3, NULL,
  312. ai_move, 2, NULL
  313. };
  314. mmove_t soldier_move_pain2 = {FRAME_pain201, FRAME_pain207, soldier_frames_pain2, soldier_run};
  315. mframe_t soldier_frames_pain3 [] =
  316. {
  317. ai_move, -8, NULL,
  318. ai_move, 10, NULL,
  319. ai_move, -4, NULL,
  320. ai_move, -1, NULL,
  321. ai_move, -3, NULL,
  322. ai_move, 0, NULL,
  323. ai_move, 3, NULL,
  324. ai_move, 0, NULL,
  325. ai_move, 0, NULL,
  326. ai_move, 0, NULL,
  327. ai_move, 0, NULL,
  328. ai_move, 1, NULL,
  329. ai_move, 0, NULL,
  330. ai_move, 1, NULL,
  331. ai_move, 2, NULL,
  332. ai_move, 4, NULL,
  333. ai_move, 3, NULL,
  334. ai_move, 2, NULL
  335. };
  336. mmove_t soldier_move_pain3 = {FRAME_pain301, FRAME_pain318, soldier_frames_pain3, soldier_run};
  337. mframe_t soldier_frames_pain4 [] =
  338. {
  339. ai_move, 0, NULL,
  340. ai_move, 0, NULL,
  341. ai_move, 0, NULL,
  342. ai_move, -10, NULL,
  343. ai_move, -6, NULL,
  344. ai_move, 8, NULL,
  345. ai_move, 4, NULL,
  346. ai_move, 1, NULL,
  347. ai_move, 0, NULL,
  348. ai_move, 2, NULL,
  349. ai_move, 5, NULL,
  350. ai_move, 2, NULL,
  351. ai_move, -1, NULL,
  352. ai_move, -1, NULL,
  353. ai_move, 3, NULL,
  354. ai_move, 2, NULL,
  355. ai_move, 0, NULL
  356. };
  357. mmove_t soldier_move_pain4 = {FRAME_pain401, FRAME_pain417, soldier_frames_pain4, soldier_run};
  358. void soldier_pain (edict_t *self, edict_t *other, float kick, int damage)
  359. {
  360. float r;
  361. int n;
  362. if (self->health < (self->max_health / 2))
  363. self->s.skinnum |= 1;
  364. if (level.time < self->pain_debounce_time)
  365. {
  366. if ((self->velocity[2] > 100) && ( (self->monsterinfo.currentmove == &soldier_move_pain1) || (self->monsterinfo.currentmove == &soldier_move_pain2) || (self->monsterinfo.currentmove == &soldier_move_pain3)))
  367. self->monsterinfo.currentmove = &soldier_move_pain4;
  368. return;
  369. }
  370. self->pain_debounce_time = level.time + 3;
  371. n = self->s.skinnum | 1;
  372. if (n == 1)
  373. gi.sound (self, CHAN_VOICE, sound_pain_light, 1, ATTN_NORM, 0);
  374. else if (n == 3)
  375. gi.sound (self, CHAN_VOICE, sound_pain, 1, ATTN_NORM, 0);
  376. else
  377. gi.sound (self, CHAN_VOICE, sound_pain_ss, 1, ATTN_NORM, 0);
  378. if (self->velocity[2] > 100)
  379. {
  380. self->monsterinfo.currentmove = &soldier_move_pain4;
  381. return;
  382. }
  383. if (skill->value == 3)
  384. return; // no pain anims in nightmare
  385. r = random();
  386. if (r < 0.33)
  387. self->monsterinfo.currentmove = &soldier_move_pain1;
  388. else if (r < 0.66)
  389. self->monsterinfo.currentmove = &soldier_move_pain2;
  390. else
  391. self->monsterinfo.currentmove = &soldier_move_pain3;
  392. }
  393. //
  394. // ATTACK
  395. //
  396. static int blaster_flash [] = {MZ2_SOLDIER_BLASTER_1, MZ2_SOLDIER_BLASTER_2, MZ2_SOLDIER_BLASTER_3, MZ2_SOLDIER_BLASTER_4, MZ2_SOLDIER_BLASTER_5, MZ2_SOLDIER_BLASTER_6, MZ2_SOLDIER_BLASTER_7, MZ2_SOLDIER_BLASTER_8};
  397. static int shotgun_flash [] = {MZ2_SOLDIER_SHOTGUN_1, MZ2_SOLDIER_SHOTGUN_2, MZ2_SOLDIER_SHOTGUN_3, MZ2_SOLDIER_SHOTGUN_4, MZ2_SOLDIER_SHOTGUN_5, MZ2_SOLDIER_SHOTGUN_6, MZ2_SOLDIER_SHOTGUN_7, MZ2_SOLDIER_SHOTGUN_8};
  398. static int machinegun_flash [] = {MZ2_SOLDIER_MACHINEGUN_1, MZ2_SOLDIER_MACHINEGUN_2, MZ2_SOLDIER_MACHINEGUN_3, MZ2_SOLDIER_MACHINEGUN_4, MZ2_SOLDIER_MACHINEGUN_5, MZ2_SOLDIER_MACHINEGUN_6, MZ2_SOLDIER_MACHINEGUN_7, MZ2_SOLDIER_MACHINEGUN_8};
  399. void soldier_fire (edict_t *self, int flash_number)
  400. {
  401. vec3_t start;
  402. vec3_t forward, right, up;
  403. vec3_t aim;
  404. vec3_t dir;
  405. vec3_t end;
  406. float r, u;
  407. int flash_index;
  408. if (self->s.skinnum < 2)
  409. flash_index = blaster_flash[flash_number];
  410. else if (self->s.skinnum < 4)
  411. flash_index = shotgun_flash[flash_number];
  412. else
  413. flash_index = machinegun_flash[flash_number];
  414. AngleVectors (self->s.angles, forward, right, NULL);
  415. G_ProjectSource (self->s.origin, monster_flash_offset[flash_index], forward, right, start);
  416. if (flash_number == 5 || flash_number == 6)
  417. {
  418. VectorCopy (forward, aim);
  419. }
  420. else
  421. {
  422. VectorCopy (self->enemy->s.origin, end);
  423. end[2] += self->enemy->viewheight;
  424. VectorSubtract (end, start, aim);
  425. vectoangles (aim, dir);
  426. AngleVectors (dir, forward, right, up);
  427. r = crandom()*1000;
  428. u = crandom()*500;
  429. VectorMA (start, 8192, forward, end);
  430. VectorMA (end, r, right, end);
  431. VectorMA (end, u, up, end);
  432. VectorSubtract (end, start, aim);
  433. VectorNormalize (aim);
  434. }
  435. if (self->s.skinnum <= 1)
  436. {
  437. monster_fire_blaster (self, start, aim, 5, 600, flash_index, EF_BLASTER);
  438. }
  439. else if (self->s.skinnum <= 3)
  440. {
  441. monster_fire_shotgun (self, start, aim, 2, 1, DEFAULT_SHOTGUN_HSPREAD, DEFAULT_SHOTGUN_VSPREAD, DEFAULT_SHOTGUN_COUNT, flash_index);
  442. }
  443. else
  444. {
  445. if (!(self->monsterinfo.aiflags & AI_HOLD_FRAME))
  446. self->monsterinfo.pausetime = level.time + (3 + rand() % 8) * FRAMETIME;
  447. monster_fire_bullet (self, start, aim, 2, 4, DEFAULT_BULLET_HSPREAD, DEFAULT_BULLET_VSPREAD, flash_index);
  448. if (level.time >= self->monsterinfo.pausetime)
  449. self->monsterinfo.aiflags &= ~AI_HOLD_FRAME;
  450. else
  451. self->monsterinfo.aiflags |= AI_HOLD_FRAME;
  452. }
  453. }
  454. // ATTACK1 (blaster/shotgun)
  455. void soldier_fire1 (edict_t *self)
  456. {
  457. soldier_fire (self, 0);
  458. }
  459. void soldier_attack1_refire1 (edict_t *self)
  460. {
  461. if (self->s.skinnum > 1)
  462. return;
  463. if (self->enemy->health <= 0)
  464. return;
  465. if ( ((skill->value == 3) && (random() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE) )
  466. self->monsterinfo.nextframe = FRAME_attak102;
  467. else
  468. self->monsterinfo.nextframe = FRAME_attak110;
  469. }
  470. void soldier_attack1_refire2 (edict_t *self)
  471. {
  472. if (self->s.skinnum < 2)
  473. return;
  474. if (self->enemy->health <= 0)
  475. return;
  476. if ( ((skill->value == 3) && (random() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE) )
  477. self->monsterinfo.nextframe = FRAME_attak102;
  478. }
  479. mframe_t soldier_frames_attack1 [] =
  480. {
  481. ai_charge, 0, NULL,
  482. ai_charge, 0, NULL,
  483. ai_charge, 0, soldier_fire1,
  484. ai_charge, 0, NULL,
  485. ai_charge, 0, NULL,
  486. ai_charge, 0, soldier_attack1_refire1,
  487. ai_charge, 0, NULL,
  488. ai_charge, 0, soldier_cock,
  489. ai_charge, 0, soldier_attack1_refire2,
  490. ai_charge, 0, NULL,
  491. ai_charge, 0, NULL,
  492. ai_charge, 0, NULL
  493. };
  494. mmove_t soldier_move_attack1 = {FRAME_attak101, FRAME_attak112, soldier_frames_attack1, soldier_run};
  495. // ATTACK2 (blaster/shotgun)
  496. void soldier_fire2 (edict_t *self)
  497. {
  498. soldier_fire (self, 1);
  499. }
  500. void soldier_attack2_refire1 (edict_t *self)
  501. {
  502. if (self->s.skinnum > 1)
  503. return;
  504. if (self->enemy->health <= 0)
  505. return;
  506. if ( ((skill->value == 3) && (random() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE) )
  507. self->monsterinfo.nextframe = FRAME_attak204;
  508. else
  509. self->monsterinfo.nextframe = FRAME_attak216;
  510. }
  511. void soldier_attack2_refire2 (edict_t *self)
  512. {
  513. if (self->s.skinnum < 2)
  514. return;
  515. if (self->enemy->health <= 0)
  516. return;
  517. if ( ((skill->value == 3) && (random() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE) )
  518. self->monsterinfo.nextframe = FRAME_attak204;
  519. }
  520. mframe_t soldier_frames_attack2 [] =
  521. {
  522. ai_charge, 0, NULL,
  523. ai_charge, 0, NULL,
  524. ai_charge, 0, NULL,
  525. ai_charge, 0, NULL,
  526. ai_charge, 0, soldier_fire2,
  527. ai_charge, 0, NULL,
  528. ai_charge, 0, NULL,
  529. ai_charge, 0, soldier_attack2_refire1,
  530. ai_charge, 0, NULL,
  531. ai_charge, 0, NULL,
  532. ai_charge, 0, NULL,
  533. ai_charge, 0, NULL,
  534. ai_charge, 0, soldier_cock,
  535. ai_charge, 0, NULL,
  536. ai_charge, 0, soldier_attack2_refire2,
  537. ai_charge, 0, NULL,
  538. ai_charge, 0, NULL,
  539. ai_charge, 0, NULL
  540. };
  541. mmove_t soldier_move_attack2 = {FRAME_attak201, FRAME_attak218, soldier_frames_attack2, soldier_run};
  542. // ATTACK3 (duck and shoot)
  543. void soldier_duck_down (edict_t *self)
  544. {
  545. if (self->monsterinfo.aiflags & AI_DUCKED)
  546. return;
  547. self->monsterinfo.aiflags |= AI_DUCKED;
  548. self->maxs[2] -= 32;
  549. self->takedamage = DAMAGE_YES;
  550. self->monsterinfo.pausetime = level.time + 1;
  551. gi.linkentity (self);
  552. }
  553. void soldier_duck_up (edict_t *self)
  554. {
  555. self->monsterinfo.aiflags &= ~AI_DUCKED;
  556. self->maxs[2] += 32;
  557. self->takedamage = DAMAGE_AIM;
  558. gi.linkentity (self);
  559. }
  560. void soldier_fire3 (edict_t *self)
  561. {
  562. soldier_duck_down (self);
  563. soldier_fire (self, 2);
  564. }
  565. void soldier_attack3_refire (edict_t *self)
  566. {
  567. if ((level.time + 0.4) < self->monsterinfo.pausetime)
  568. self->monsterinfo.nextframe = FRAME_attak303;
  569. }
  570. mframe_t soldier_frames_attack3 [] =
  571. {
  572. ai_charge, 0, NULL,
  573. ai_charge, 0, NULL,
  574. ai_charge, 0, soldier_fire3,
  575. ai_charge, 0, NULL,
  576. ai_charge, 0, NULL,
  577. ai_charge, 0, soldier_attack3_refire,
  578. ai_charge, 0, soldier_duck_up,
  579. ai_charge, 0, NULL,
  580. ai_charge, 0, NULL
  581. };
  582. mmove_t soldier_move_attack3 = {FRAME_attak301, FRAME_attak309, soldier_frames_attack3, soldier_run};
  583. // ATTACK4 (machinegun)
  584. void soldier_fire4 (edict_t *self)
  585. {
  586. soldier_fire (self, 3);
  587. //
  588. // if (self->enemy->health <= 0)
  589. // return;
  590. //
  591. // if ( ((skill->value == 3) && (random() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE) )
  592. // self->monsterinfo.nextframe = FRAME_attak402;
  593. }
  594. mframe_t soldier_frames_attack4 [] =
  595. {
  596. ai_charge, 0, NULL,
  597. ai_charge, 0, NULL,
  598. ai_charge, 0, soldier_fire4,
  599. ai_charge, 0, NULL,
  600. ai_charge, 0, NULL,
  601. ai_charge, 0, NULL
  602. };
  603. mmove_t soldier_move_attack4 = {FRAME_attak401, FRAME_attak406, soldier_frames_attack4, soldier_run};
  604. #if 0
  605. // ATTACK5 (prone)
  606. void soldier_fire5 (edict_t *self)
  607. {
  608. soldier_fire (self, 4);
  609. }
  610. void soldier_attack5_refire (edict_t *self)
  611. {
  612. if (self->enemy->health <= 0)
  613. return;
  614. if ( ((skill->value == 3) && (random() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE) )
  615. self->monsterinfo.nextframe = FRAME_attak505;
  616. }
  617. mframe_t soldier_frames_attack5 [] =
  618. {
  619. ai_charge, 8, NULL,
  620. ai_charge, 8, NULL,
  621. ai_charge, 0, NULL,
  622. ai_charge, 0, NULL,
  623. ai_charge, 0, soldier_fire5,
  624. ai_charge, 0, NULL,
  625. ai_charge, 0, NULL,
  626. ai_charge, 0, soldier_attack5_refire
  627. };
  628. mmove_t soldier_move_attack5 = {FRAME_attak501, FRAME_attak508, soldier_frames_attack5, soldier_run};
  629. #endif
  630. // ATTACK6 (run & shoot)
  631. void soldier_fire8 (edict_t *self)
  632. {
  633. soldier_fire (self, 7);
  634. }
  635. void soldier_attack6_refire (edict_t *self)
  636. {
  637. if (self->enemy->health <= 0)
  638. return;
  639. if (range(self, self->enemy) < RANGE_MID)
  640. return;
  641. if (skill->value == 3)
  642. self->monsterinfo.nextframe = FRAME_runs03;
  643. }
  644. mframe_t soldier_frames_attack6 [] =
  645. {
  646. ai_charge, 10, NULL,
  647. ai_charge, 4, NULL,
  648. ai_charge, 12, NULL,
  649. ai_charge, 11, soldier_fire8,
  650. ai_charge, 13, NULL,
  651. ai_charge, 18, NULL,
  652. ai_charge, 15, NULL,
  653. ai_charge, 14, NULL,
  654. ai_charge, 11, NULL,
  655. ai_charge, 8, NULL,
  656. ai_charge, 11, NULL,
  657. ai_charge, 12, NULL,
  658. ai_charge, 12, NULL,
  659. ai_charge, 17, soldier_attack6_refire
  660. };
  661. mmove_t soldier_move_attack6 = {FRAME_runs01, FRAME_runs14, soldier_frames_attack6, soldier_run};
  662. void soldier_attack(edict_t *self)
  663. {
  664. if (self->s.skinnum < 4)
  665. {
  666. if (random() < 0.5)
  667. self->monsterinfo.currentmove = &soldier_move_attack1;
  668. else
  669. self->monsterinfo.currentmove = &soldier_move_attack2;
  670. }
  671. else
  672. {
  673. self->monsterinfo.currentmove = &soldier_move_attack4;
  674. }
  675. }
  676. //
  677. // SIGHT
  678. //
  679. void soldier_sight(edict_t *self, edict_t *other)
  680. {
  681. if (random() < 0.5)
  682. gi.sound (self, CHAN_VOICE, sound_sight1, 1, ATTN_NORM, 0);
  683. else
  684. gi.sound (self, CHAN_VOICE, sound_sight2, 1, ATTN_NORM, 0);
  685. if ((skill->value > 0) && (range(self, self->enemy) >= RANGE_MID))
  686. {
  687. if (random() > 0.5)
  688. self->monsterinfo.currentmove = &soldier_move_attack6;
  689. }
  690. }
  691. //
  692. // DUCK
  693. //
  694. void soldier_duck_hold (edict_t *self)
  695. {
  696. if (level.time >= self->monsterinfo.pausetime)
  697. self->monsterinfo.aiflags &= ~AI_HOLD_FRAME;
  698. else
  699. self->monsterinfo.aiflags |= AI_HOLD_FRAME;
  700. }
  701. mframe_t soldier_frames_duck [] =
  702. {
  703. ai_move, 5, soldier_duck_down,
  704. ai_move, -1, soldier_duck_hold,
  705. ai_move, 1, NULL,
  706. ai_move, 0, soldier_duck_up,
  707. ai_move, 5, NULL
  708. };
  709. mmove_t soldier_move_duck = {FRAME_duck01, FRAME_duck05, soldier_frames_duck, soldier_run};
  710. void soldier_dodge (edict_t *self, edict_t *attacker, float eta)
  711. {
  712. float r;
  713. r = random();
  714. if (r > 0.25)
  715. return;
  716. if (!self->enemy)
  717. self->enemy = attacker;
  718. if (skill->value == 0)
  719. {
  720. self->monsterinfo.currentmove = &soldier_move_duck;
  721. return;
  722. }
  723. self->monsterinfo.pausetime = level.time + eta + 0.3;
  724. r = random();
  725. if (skill->value == 1)
  726. {
  727. if (r > 0.33)
  728. self->monsterinfo.currentmove = &soldier_move_duck;
  729. else
  730. self->monsterinfo.currentmove = &soldier_move_attack3;
  731. return;
  732. }
  733. if (skill->value >= 2)
  734. {
  735. if (r > 0.66)
  736. self->monsterinfo.currentmove = &soldier_move_duck;
  737. else
  738. self->monsterinfo.currentmove = &soldier_move_attack3;
  739. return;
  740. }
  741. self->monsterinfo.currentmove = &soldier_move_attack3;
  742. }
  743. //
  744. // DEATH
  745. //
  746. void soldier_fire6 (edict_t *self)
  747. {
  748. soldier_fire (self, 5);
  749. }
  750. void soldier_fire7 (edict_t *self)
  751. {
  752. soldier_fire (self, 6);
  753. }
  754. void soldier_dead (edict_t *self)
  755. {
  756. VectorSet (self->mins, -16, -16, -24);
  757. VectorSet (self->maxs, 16, 16, -8);
  758. self->movetype = MOVETYPE_TOSS;
  759. self->svflags |= SVF_DEADMONSTER;
  760. self->nextthink = 0;
  761. gi.linkentity (self);
  762. }
  763. mframe_t soldier_frames_death1 [] =
  764. {
  765. ai_move, 0, NULL,
  766. ai_move, -10, NULL,
  767. ai_move, -10, NULL,
  768. ai_move, -10, NULL,
  769. ai_move, -5, NULL,
  770. ai_move, 0, NULL,
  771. ai_move, 0, NULL,
  772. ai_move, 0, NULL,
  773. ai_move, 0, NULL,
  774. ai_move, 0, NULL,
  775. ai_move, 0, NULL,
  776. ai_move, 0, NULL,
  777. ai_move, 0, NULL,
  778. ai_move, 0, NULL,
  779. ai_move, 0, NULL,
  780. ai_move, 0, NULL,
  781. ai_move, 0, NULL,
  782. ai_move, 0, NULL,
  783. ai_move, 0, NULL,
  784. ai_move, 0, NULL,
  785. ai_move, 0, NULL,
  786. ai_move, 0, soldier_fire6,
  787. ai_move, 0, NULL,
  788. ai_move, 0, NULL,
  789. ai_move, 0, soldier_fire7,
  790. ai_move, 0, NULL,
  791. ai_move, 0, NULL,
  792. ai_move, 0, NULL,
  793. ai_move, 0, NULL,
  794. ai_move, 0, NULL,
  795. ai_move, 0, NULL,
  796. ai_move, 0, NULL,
  797. ai_move, 0, NULL,
  798. ai_move, 0, NULL,
  799. ai_move, 0, NULL,
  800. ai_move, 0, NULL
  801. };
  802. mmove_t soldier_move_death1 = {FRAME_death101, FRAME_death136, soldier_frames_death1, soldier_dead};
  803. mframe_t soldier_frames_death2 [] =
  804. {
  805. ai_move, -5, NULL,
  806. ai_move, -5, NULL,
  807. ai_move, -5, NULL,
  808. ai_move, 0, NULL,
  809. ai_move, 0, NULL,
  810. ai_move, 0, NULL,
  811. ai_move, 0, NULL,
  812. ai_move, 0, NULL,
  813. ai_move, 0, NULL,
  814. ai_move, 0, NULL,
  815. ai_move, 0, NULL,
  816. ai_move, 0, NULL,
  817. ai_move, 0, NULL,
  818. ai_move, 0, NULL,
  819. ai_move, 0, NULL,
  820. ai_move, 0, NULL,
  821. ai_move, 0, NULL,
  822. ai_move, 0, NULL,
  823. ai_move, 0, NULL,
  824. ai_move, 0, NULL,
  825. ai_move, 0, NULL,
  826. ai_move, 0, NULL,
  827. ai_move, 0, NULL,
  828. ai_move, 0, NULL,
  829. ai_move, 0, NULL,
  830. ai_move, 0, NULL,
  831. ai_move, 0, NULL,
  832. ai_move, 0, NULL,
  833. ai_move, 0, NULL,
  834. ai_move, 0, NULL,
  835. ai_move, 0, NULL,
  836. ai_move, 0, NULL,
  837. ai_move, 0, NULL,
  838. ai_move, 0, NULL,
  839. ai_move, 0, NULL
  840. };
  841. mmove_t soldier_move_death2 = {FRAME_death201, FRAME_death235, soldier_frames_death2, soldier_dead};
  842. mframe_t soldier_frames_death3 [] =
  843. {
  844. ai_move, -5, NULL,
  845. ai_move, -5, NULL,
  846. ai_move, -5, NULL,
  847. ai_move, 0, NULL,
  848. ai_move, 0, NULL,
  849. ai_move, 0, NULL,
  850. ai_move, 0, NULL,
  851. ai_move, 0, NULL,
  852. ai_move, 0, NULL,
  853. ai_move, 0, NULL,
  854. ai_move, 0, NULL,
  855. ai_move, 0, NULL,
  856. ai_move, 0, NULL,
  857. ai_move, 0, NULL,
  858. ai_move, 0, NULL,
  859. ai_move, 0, NULL,
  860. ai_move, 0, NULL,
  861. ai_move, 0, NULL,
  862. ai_move, 0, NULL,
  863. ai_move, 0, NULL,
  864. ai_move, 0, NULL,
  865. ai_move, 0, NULL,
  866. ai_move, 0, NULL,
  867. ai_move, 0, NULL,
  868. ai_move, 0, NULL,
  869. ai_move, 0, NULL,
  870. ai_move, 0, NULL,
  871. ai_move, 0, NULL,
  872. ai_move, 0, NULL,
  873. ai_move, 0, NULL,
  874. ai_move, 0, NULL,
  875. ai_move, 0, NULL,
  876. ai_move, 0, NULL,
  877. ai_move, 0, NULL,
  878. ai_move, 0, NULL,
  879. ai_move, 0, NULL,
  880. ai_move, 0, NULL,
  881. ai_move, 0, NULL,
  882. ai_move, 0, NULL,
  883. ai_move, 0, NULL,
  884. ai_move, 0, NULL,
  885. ai_move, 0, NULL,
  886. ai_move, 0, NULL,
  887. ai_move, 0, NULL,
  888. ai_move, 0, NULL,
  889. };
  890. mmove_t soldier_move_death3 = {FRAME_death301, FRAME_death345, soldier_frames_death3, soldier_dead};
  891. mframe_t soldier_frames_death4 [] =
  892. {
  893. ai_move, 0, NULL,
  894. ai_move, 0, NULL,
  895. ai_move, 0, NULL,
  896. ai_move, 0, NULL,
  897. ai_move, 0, NULL,
  898. ai_move, 0, NULL,
  899. ai_move, 0, NULL,
  900. ai_move, 0, NULL,
  901. ai_move, 0, NULL,
  902. ai_move, 0, NULL,
  903. ai_move, 0, NULL,
  904. ai_move, 0, NULL,
  905. ai_move, 0, NULL,
  906. ai_move, 0, NULL,
  907. ai_move, 0, NULL,
  908. ai_move, 0, NULL,
  909. ai_move, 0, NULL,
  910. ai_move, 0, NULL,
  911. ai_move, 0, NULL,
  912. ai_move, 0, NULL,
  913. ai_move, 0, NULL,
  914. ai_move, 0, NULL,
  915. ai_move, 0, NULL,
  916. ai_move, 0, NULL,
  917. ai_move, 0, NULL,
  918. ai_move, 0, NULL,
  919. ai_move, 0, NULL,
  920. ai_move, 0, NULL,
  921. ai_move, 0, NULL,
  922. ai_move, 0, NULL,
  923. ai_move, 0, NULL,
  924. ai_move, 0, NULL,
  925. ai_move, 0, NULL,
  926. ai_move, 0, NULL,
  927. ai_move, 0, NULL,
  928. ai_move, 0, NULL,
  929. ai_move, 0, NULL,
  930. ai_move, 0, NULL,
  931. ai_move, 0, NULL,
  932. ai_move, 0, NULL,
  933. ai_move, 0, NULL,
  934. ai_move, 0, NULL,
  935. ai_move, 0, NULL,
  936. ai_move, 0, NULL,
  937. ai_move, 0, NULL,
  938. ai_move, 0, NULL,
  939. ai_move, 0, NULL,
  940. ai_move, 0, NULL,
  941. ai_move, 0, NULL,
  942. ai_move, 0, NULL,
  943. ai_move, 0, NULL,
  944. ai_move, 0, NULL,
  945. ai_move, 0, NULL
  946. };
  947. mmove_t soldier_move_death4 = {FRAME_death401, FRAME_death453, soldier_frames_death4, soldier_dead};
  948. mframe_t soldier_frames_death5 [] =
  949. {
  950. ai_move, -5, NULL,
  951. ai_move, -5, NULL,
  952. ai_move, -5, NULL,
  953. ai_move, 0, NULL,
  954. ai_move, 0, NULL,
  955. ai_move, 0, NULL,
  956. ai_move, 0, NULL,
  957. ai_move, 0, NULL,
  958. ai_move, 0, NULL,
  959. ai_move, 0, NULL,
  960. ai_move, 0, NULL,
  961. ai_move, 0, NULL,
  962. ai_move, 0, NULL,
  963. ai_move, 0, NULL,
  964. ai_move, 0, NULL,
  965. ai_move, 0, NULL,
  966. ai_move, 0, NULL,
  967. ai_move, 0, NULL,
  968. ai_move, 0, NULL,
  969. ai_move, 0, NULL,
  970. ai_move, 0, NULL,
  971. ai_move, 0, NULL,
  972. ai_move, 0, NULL,
  973. ai_move, 0, NULL
  974. };
  975. mmove_t soldier_move_death5 = {FRAME_death501, FRAME_death524, soldier_frames_death5, soldier_dead};
  976. mframe_t soldier_frames_death6 [] =
  977. {
  978. ai_move, 0, NULL,
  979. ai_move, 0, NULL,
  980. ai_move, 0, NULL,
  981. ai_move, 0, NULL,
  982. ai_move, 0, NULL,
  983. ai_move, 0, NULL,
  984. ai_move, 0, NULL,
  985. ai_move, 0, NULL,
  986. ai_move, 0, NULL,
  987. ai_move, 0, NULL
  988. };
  989. mmove_t soldier_move_death6 = {FRAME_death601, FRAME_death610, soldier_frames_death6, soldier_dead};
  990. void soldier_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point)
  991. {
  992. int n;
  993. // check for gib
  994. if (self->health <= self->gib_health)
  995. {
  996. gi.sound (self, CHAN_VOICE, gi.soundindex ("misc/udeath.wav"), 1, ATTN_NORM, 0);
  997. for (n= 0; n < 3; n++)
  998. ThrowGib (self, "models/objects/gibs/sm_meat/tris.md2", damage, GIB_ORGANIC);
  999. ThrowGib (self, "models/objects/gibs/chest/tris.md2", damage, GIB_ORGANIC);
  1000. ThrowHead (self, "models/objects/gibs/head2/tris.md2", damage, GIB_ORGANIC);
  1001. self->deadflag = DEAD_DEAD;
  1002. return;
  1003. }
  1004. if (self->deadflag == DEAD_DEAD)
  1005. return;
  1006. // regular death
  1007. self->deadflag = DEAD_DEAD;
  1008. self->takedamage = DAMAGE_YES;
  1009. self->s.skinnum |= 1;
  1010. if (self->s.skinnum == 1)
  1011. gi.sound (self, CHAN_VOICE, sound_death_light, 1, ATTN_NORM, 0);
  1012. else if (self->s.skinnum == 3)
  1013. gi.sound (self, CHAN_VOICE, sound_death, 1, ATTN_NORM, 0);
  1014. else // (self->s.skinnum == 5)
  1015. gi.sound (self, CHAN_VOICE, sound_death_ss, 1, ATTN_NORM, 0);
  1016. if (fabs((self->s.origin[2] + self->viewheight) - point[2]) <= 4)
  1017. {
  1018. // head shot
  1019. self->monsterinfo.currentmove = &soldier_move_death3;
  1020. return;
  1021. }
  1022. n = rand() % 5;
  1023. if (n == 0)
  1024. self->monsterinfo.currentmove = &soldier_move_death1;
  1025. else if (n == 1)
  1026. self->monsterinfo.currentmove = &soldier_move_death2;
  1027. else if (n == 2)
  1028. self->monsterinfo.currentmove = &soldier_move_death4;
  1029. else if (n == 3)
  1030. self->monsterinfo.currentmove = &soldier_move_death5;
  1031. else
  1032. self->monsterinfo.currentmove = &soldier_move_death6;
  1033. }
  1034. //
  1035. // SPAWN
  1036. //
  1037. void SP_monster_soldier_x (edict_t *self)
  1038. {
  1039. self->s.modelindex = gi.modelindex ("models/monsters/soldier/tris.md2");
  1040. self->monsterinfo.scale = MODEL_SCALE;
  1041. VectorSet (self->mins, -16, -16, -24);
  1042. VectorSet (self->maxs, 16, 16, 32);
  1043. self->movetype = MOVETYPE_STEP;
  1044. self->solid = SOLID_BBOX;
  1045. sound_idle = gi.soundindex ("soldier/solidle1.wav");
  1046. sound_sight1 = gi.soundindex ("soldier/solsght1.wav");
  1047. sound_sight2 = gi.soundindex ("soldier/solsrch1.wav");
  1048. sound_cock = gi.soundindex ("infantry/infatck3.wav");
  1049. self->mass = 100;
  1050. self->pain = soldier_pain;
  1051. self->die = soldier_die;
  1052. self->monsterinfo.stand = soldier_stand;
  1053. self->monsterinfo.walk = soldier_walk;
  1054. self->monsterinfo.run = soldier_run;
  1055. self->monsterinfo.dodge = soldier_dodge;
  1056. self->monsterinfo.attack = soldier_attack;
  1057. self->monsterinfo.melee = NULL;
  1058. self->monsterinfo.sight = soldier_sight;
  1059. gi.linkentity (self);
  1060. self->monsterinfo.stand (self);
  1061. walkmonster_start (self);
  1062. }
  1063. /*QUAKED monster_soldier_light (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn Sight
  1064. */
  1065. void SP_monster_soldier_light (edict_t *self)
  1066. {
  1067. if (deathmatch->value)
  1068. {
  1069. G_FreeEdict (self);
  1070. return;
  1071. }
  1072. SP_monster_soldier_x (self);
  1073. sound_pain_light = gi.soundindex ("soldier/solpain2.wav");
  1074. sound_death_light = gi.soundindex ("soldier/soldeth2.wav");
  1075. gi.modelindex ("models/objects/laser/tris.md2");
  1076. gi.soundindex ("misc/lasfly.wav");
  1077. gi.soundindex ("soldier/solatck2.wav");
  1078. self->s.skinnum = 0;
  1079. self->health = 20;
  1080. self->gib_health = -30;
  1081. }
  1082. /*QUAKED monster_soldier (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn Sight
  1083. */
  1084. void SP_monster_soldier (edict_t *self)
  1085. {
  1086. if (deathmatch->value)
  1087. {
  1088. G_FreeEdict (self);
  1089. return;
  1090. }
  1091. SP_monster_soldier_x (self);
  1092. sound_pain = gi.soundindex ("soldier/solpain1.wav");
  1093. sound_death = gi.soundindex ("soldier/soldeth1.wav");
  1094. gi.soundindex ("soldier/solatck1.wav");
  1095. self->s.skinnum = 2;
  1096. self->health = 30;
  1097. self->gib_health = -30;
  1098. }
  1099. /*QUAKED monster_soldier_ss (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn Sight
  1100. */
  1101. void SP_monster_soldier_ss (edict_t *self)
  1102. {
  1103. if (deathmatch->value)
  1104. {
  1105. G_FreeEdict (self);
  1106. return;
  1107. }
  1108. SP_monster_soldier_x (self);
  1109. sound_pain_ss = gi.soundindex ("soldier/solpain3.wav");
  1110. sound_death_ss = gi.soundindex ("soldier/soldeth3.wav");
  1111. gi.soundindex ("soldier/solatck3.wav");
  1112. self->s.skinnum = 4;
  1113. self->health = 40;
  1114. self->gib_health = -30;
  1115. }