m_widow2.c 46 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795
  1. // Copyright (c) ZeniMax Media Inc.
  2. // Licensed under the GNU General Public License 2.0.
  3. /*
  4. ==============================================================================
  5. black widow, part 2
  6. ==============================================================================
  7. */
  8. // timestamp used to prevent rapid fire of melee attack
  9. #include "g_local.h"
  10. #include "m_widow2.h"
  11. #define NUM_STALKERS_SPAWNED 6 // max # of stalkers she can spawn
  12. #define DISRUPT_TIME 3
  13. static int sound_pain1;
  14. static int sound_pain2;
  15. static int sound_pain3;
  16. static int sound_death;
  17. static int sound_search1;
  18. static int sound_disrupt;
  19. static int sound_tentacles_retract;
  20. // sqrt(64*64*2) + sqrt(28*28*2) => 130.1
  21. static vec3_t spawnpoints[] = {
  22. {30, 135, 0},
  23. {30, -135, 0}
  24. };
  25. static float sweep_angles[] = {
  26. -40.0, -32.0, -24.0, -16.0, -8.0, 0.0, 8.0, 16.0, 24.0, 32.0, 40.0
  27. };
  28. extern vec3_t stalker_mins, stalker_maxs;
  29. qboolean infront (edict_t *self, edict_t *other);
  30. void WidowCalcSlots (edict_t *self);
  31. void WidowPowerups (edict_t *self);
  32. void widow2_run (edict_t *self);
  33. void widow2_stand (edict_t *self);
  34. void widow2_dead (edict_t *self);
  35. void widow2_attack (edict_t *self);
  36. void widow2_attack_beam (edict_t *self);
  37. void widow2_reattack_beam (edict_t *self);
  38. void widow2_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point);
  39. void widow_start_spawn (edict_t *self);
  40. void widow_done_spawn (edict_t *self);
  41. void widow2_spawn_check (edict_t *self);
  42. void widow2_prep_spawn (edict_t *self);
  43. void Widow2SaveBeamTarget(edict_t *self);
  44. // death stuff
  45. void WidowExplode (edict_t *self);
  46. void gib_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point);
  47. void gib_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf);
  48. void ThrowWidowGibReal (edict_t *self, char *gibname, int damage, int type, vec3_t startpos, qboolean large, int hitsound, qboolean fade);
  49. void ThrowWidowGibSized (edict_t *self, char *gibname, int damage, int type, vec3_t startpos, int hitsound, qboolean fade);
  50. void ThrowWidowGibLoc (edict_t *self, char *gibname, int damage, int type, vec3_t startpos, qboolean fade);
  51. void WidowExplosion1 (edict_t *self);
  52. void WidowExplosion2 (edict_t *self);
  53. void WidowExplosion3 (edict_t *self);
  54. void WidowExplosion4 (edict_t *self);
  55. void WidowExplosion5 (edict_t *self);
  56. void WidowExplosion6 (edict_t *self);
  57. void WidowExplosion7 (edict_t *self);
  58. void WidowExplosionLeg (edict_t *self);
  59. void ThrowArm1 (edict_t *self);
  60. void ThrowArm2 (edict_t *self);
  61. void ClipGibVelocity (edict_t *ent);
  62. // end of death stuff
  63. // these offsets used by the tongue
  64. static vec3_t offsets[] = {
  65. {17.48, 0.10, 68.92},
  66. {17.47, 0.29, 68.91},
  67. {17.45, 0.53, 68.87},
  68. {17.42, 0.78, 68.81},
  69. {17.39, 1.02, 68.75},
  70. {17.37, 1.20, 68.70},
  71. {17.36, 1.24, 68.71},
  72. {17.37, 1.21, 68.72},
  73. };
  74. void showme (edict_t *self);
  75. void pauseme (edict_t *self)
  76. {
  77. self->monsterinfo.aiflags |= AI_HOLD_FRAME;
  78. }
  79. void widow2_search (edict_t *self)
  80. {
  81. if (random() < 0.5)
  82. gi.sound (self, CHAN_VOICE, sound_search1, 1, ATTN_NONE, 0);
  83. }
  84. void Widow2Beam (edict_t *self)
  85. {
  86. vec3_t forward, right, target;
  87. vec3_t start, targ_angles, vec;
  88. int flashnum;
  89. if ((!self->enemy) || (!self->enemy->inuse))
  90. return;
  91. AngleVectors (self->s.angles, forward, right, NULL);
  92. if ((self->s.frame >= FRAME_fireb05) && (self->s.frame <= FRAME_fireb09))
  93. {
  94. // regular beam attack
  95. Widow2SaveBeamTarget(self);
  96. flashnum = MZ2_WIDOW2_BEAMER_1 + self->s.frame - FRAME_fireb05;
  97. G_ProjectSource (self->s.origin, monster_flash_offset[flashnum], forward, right, start);
  98. VectorCopy (self->pos2, target);
  99. target[2] += self->enemy->viewheight-10;
  100. VectorSubtract (target, start, forward);
  101. VectorNormalize (forward);
  102. monster_fire_heat (self, start, forward, vec3_origin, 10, 50, flashnum);
  103. }
  104. else if ((self->s.frame >= FRAME_spawn04) && (self->s.frame <= FRAME_spawn14))
  105. {
  106. // sweep
  107. flashnum = MZ2_WIDOW2_BEAM_SWEEP_1 + self->s.frame - FRAME_spawn04;
  108. G_ProjectSource (self->s.origin, monster_flash_offset[flashnum], forward, right, start);
  109. VectorSubtract (self->enemy->s.origin, start, target);
  110. vectoangles2 (target, targ_angles);
  111. VectorCopy (self->s.angles, vec);
  112. vec[PITCH] += targ_angles[PITCH];
  113. vec[YAW] -= sweep_angles[flashnum-MZ2_WIDOW2_BEAM_SWEEP_1];
  114. AngleVectors (vec, forward, NULL, NULL);
  115. monster_fire_heat (self, start, forward, vec3_origin, 10, 50, flashnum);
  116. /*
  117. if (self->s.frame == FRAME_spawn04)
  118. {
  119. VectorMA (start, 1024, forward, debugend);
  120. gi.WriteByte (svc_temp_entity);
  121. gi.WriteByte (TE_DEBUGTRAIL);
  122. gi.WritePosition (start);
  123. gi.WritePosition (debugend);
  124. gi.multicast (start, MULTICAST_ALL);
  125. drawbbox (self);
  126. self->monsterinfo.aiflags |= AI_HOLD_FRAME|AI_MANUAL_STEERING;
  127. }
  128. */
  129. }
  130. else
  131. {
  132. // if ((g_showlogic) && (g_showlogic->value))
  133. // gi.dprintf ("bad fire frame for widow2 beam -- tell me you saw this!\n");
  134. Widow2SaveBeamTarget(self);
  135. G_ProjectSource (self->s.origin, monster_flash_offset[MZ2_WIDOW2_BEAMER_1], forward, right, start);
  136. VectorCopy (self->pos2, target);
  137. target[2] += self->enemy->viewheight-10;
  138. VectorSubtract (target, start, forward);
  139. VectorNormalize (forward);
  140. monster_fire_heat (self, start, forward, vec3_origin, 10, 50, 0);
  141. }
  142. }
  143. void Widow2Spawn (edict_t *self)
  144. {
  145. vec3_t f, r, u, offset, startpoint, spawnpoint;
  146. edict_t *ent, *designated_enemy;
  147. int i;
  148. AngleVectors (self->s.angles, f, r, u);
  149. for (i=0; i < 2; i++)
  150. {
  151. VectorCopy (spawnpoints[i], offset);
  152. G_ProjectSource2 (self->s.origin, offset, f, r, u, startpoint);
  153. if (FindSpawnPoint (startpoint, stalker_mins, stalker_maxs, spawnpoint, 64))
  154. {
  155. ent = CreateGroundMonster (spawnpoint, self->s.angles, stalker_mins, stalker_maxs, "monster_stalker", 256);
  156. if (!ent)
  157. continue;
  158. self->monsterinfo.monster_used++;
  159. ent->monsterinfo.commander = self;
  160. // if ((g_showlogic) && (g_showlogic->value))
  161. // gi.dprintf ("widow: post-spawn : %d slots left\n", SELF_SLOTS_LEFT);
  162. ent->nextthink = level.time;
  163. ent->think (ent);
  164. ent->monsterinfo.aiflags |= AI_SPAWNED_WIDOW|AI_DO_NOT_COUNT|AI_IGNORE_SHOTS;
  165. if (!(coop && coop->value))
  166. {
  167. designated_enemy = self->enemy;
  168. }
  169. else
  170. {
  171. designated_enemy = PickCoopTarget(ent);
  172. if (designated_enemy)
  173. {
  174. // try to avoid using my enemy
  175. if (designated_enemy == self->enemy)
  176. {
  177. designated_enemy = PickCoopTarget(ent);
  178. if (designated_enemy)
  179. {
  180. // if ((g_showlogic) && (g_showlogic->value))
  181. // {
  182. // gi.dprintf ("PickCoopTarget returned a %s - ", designated_enemy->classname);
  183. // if (designated_enemy->client)
  184. // gi.dprintf ("with name %s\n", designated_enemy->client->pers.netname);
  185. // else
  186. // gi.dprintf ("NOT A CLIENT\n");
  187. // }
  188. }
  189. else
  190. {
  191. // if ((g_showlogic) && (g_showlogic->value))
  192. // gi.dprintf ("pick coop failed, using my current enemy\n");
  193. designated_enemy = self->enemy;
  194. }
  195. }
  196. }
  197. else
  198. {
  199. // if ((g_showlogic) && (g_showlogic->value))
  200. // gi.dprintf ("pick coop failed, using my current enemy\n");
  201. designated_enemy = self->enemy;
  202. }
  203. }
  204. if ((designated_enemy->inuse) && (designated_enemy->health > 0))
  205. {
  206. ent->enemy = designated_enemy;
  207. FoundTarget (ent);
  208. ent->monsterinfo.attack(ent);
  209. }
  210. }
  211. }
  212. }
  213. void widow2_spawn_check (edict_t *self)
  214. {
  215. Widow2Beam(self);
  216. Widow2Spawn (self);
  217. }
  218. void widow2_ready_spawn (edict_t *self)
  219. {
  220. vec3_t f, r, u, offset, startpoint, spawnpoint;
  221. int i;
  222. Widow2Beam(self);
  223. AngleVectors (self->s.angles, f, r, u);
  224. for (i=0; i < 2; i++)
  225. {
  226. VectorCopy (spawnpoints[i], offset);
  227. G_ProjectSource2 (self->s.origin, offset, f, r, u, startpoint);
  228. if (FindSpawnPoint (startpoint, stalker_mins, stalker_maxs, spawnpoint, 64))
  229. {
  230. SpawnGrow_Spawn (spawnpoint, 1);
  231. }
  232. }
  233. }
  234. mframe_t widow2_frames_stand [] =
  235. {
  236. // ai_stand, 0, drawbbox
  237. ai_stand, 0, NULL
  238. };
  239. mmove_t widow2_move_stand = {FRAME_blackwidow3, FRAME_blackwidow3, widow2_frames_stand, NULL};
  240. mframe_t widow2_frames_walk [] =
  241. {
  242. // ai_walk, 9.01, drawbbox,
  243. ai_walk, 9.01, NULL,
  244. ai_walk, 7.55, NULL,
  245. ai_walk, 7.01, NULL,
  246. ai_walk, 6.66, NULL,
  247. ai_walk, 6.20, NULL,
  248. ai_walk, 5.78, NULL,
  249. ai_walk, 7.25, NULL,
  250. ai_walk, 8.37, NULL,
  251. ai_walk, 10.41, NULL
  252. };
  253. mmove_t widow2_move_walk = {FRAME_walk01, FRAME_walk09, widow2_frames_walk, NULL};
  254. mframe_t widow2_frames_run [] =
  255. {
  256. // ai_run, 9.01, drawbbox,
  257. ai_run, 9.01, NULL,
  258. ai_run, 7.55, NULL,
  259. ai_run, 7.01, NULL,
  260. ai_run, 6.66, NULL,
  261. ai_run, 6.20, NULL,
  262. ai_run, 5.78, NULL,
  263. ai_run, 7.25, NULL,
  264. ai_run, 8.37, NULL,
  265. ai_run, 10.41, NULL
  266. };
  267. mmove_t widow2_move_run = {FRAME_walk01, FRAME_walk09, widow2_frames_run, NULL};
  268. mframe_t widow2_frames_attack_pre_beam [] =
  269. {
  270. ai_charge, 4, NULL,
  271. ai_charge, 4, NULL,
  272. ai_charge, 4, NULL,
  273. ai_charge, 4, widow2_attack_beam
  274. };
  275. mmove_t widow2_move_attack_pre_beam = {FRAME_fireb01, FRAME_fireb04, widow2_frames_attack_pre_beam, NULL};
  276. // Loop this
  277. mframe_t widow2_frames_attack_beam [] =
  278. {
  279. ai_charge, 0, Widow2Beam,
  280. ai_charge, 0, Widow2Beam,
  281. ai_charge, 0, Widow2Beam,
  282. ai_charge, 0, Widow2Beam,
  283. ai_charge, 0, widow2_reattack_beam
  284. };
  285. mmove_t widow2_move_attack_beam = {FRAME_fireb05, FRAME_fireb09, widow2_frames_attack_beam, NULL};
  286. mframe_t widow2_frames_attack_post_beam [] =
  287. {
  288. ai_charge, 4, NULL,
  289. ai_charge, 4, NULL,
  290. ai_charge, 4, NULL
  291. };
  292. mmove_t widow2_move_attack_post_beam = {FRAME_fireb06, FRAME_fireb07, widow2_frames_attack_post_beam, widow2_run};
  293. void WidowDisrupt (edict_t *self)
  294. {
  295. vec3_t start;
  296. vec3_t dir;
  297. vec3_t forward, right;
  298. float len;
  299. AngleVectors (self->s.angles, forward, right, NULL);
  300. G_ProjectSource (self->s.origin, monster_flash_offset[MZ2_WIDOW_DISRUPTOR], forward, right, start);
  301. VectorSubtract (self->pos1, self->enemy->s.origin, dir);
  302. len = VectorLength (dir);
  303. if (len < 30)
  304. {
  305. // if ((g_showlogic) && (g_showlogic->value))
  306. // gi.dprintf ("target locked - dist %2.2f\n", len);
  307. // calc direction to where we targeted
  308. VectorSubtract (self->pos1, start, dir);
  309. VectorNormalize (dir);
  310. monster_fire_tracker(self, start, dir, 20, 500, self->enemy, MZ2_WIDOW_DISRUPTOR);
  311. }
  312. else
  313. {
  314. // if ((g_showlogic) && (g_showlogic->value))
  315. // gi.dprintf ("target missed - dist %2.2f\n", len);
  316. PredictAim (self->enemy, start, 1200, true, 0, dir, NULL);
  317. // VectorSubtract (self->enemy->s.origin, start, dir);
  318. // VectorNormalize (dir);
  319. monster_fire_tracker(self, start, dir, 20, 1200, NULL, MZ2_WIDOW_DISRUPTOR);
  320. }
  321. }
  322. void Widow2SaveDisruptLoc (edict_t *self)
  323. {
  324. if (self->enemy && self->enemy->inuse)
  325. {
  326. VectorCopy (self->enemy->s.origin, self->pos1); //save for aiming the shot
  327. self->pos1[2] += self->enemy->viewheight;
  328. }
  329. else
  330. VectorCopy (vec3_origin, self->pos1);
  331. };
  332. void widow2_disrupt_reattack (edict_t *self)
  333. {
  334. float luck;
  335. luck = random();
  336. if (luck < (0.25 + ((float)(skill->value))*0.15))
  337. self->monsterinfo.nextframe = FRAME_firea01;
  338. }
  339. mframe_t widow2_frames_attack_disrupt [] =
  340. {
  341. ai_charge, 2, NULL,
  342. ai_charge, 2, NULL,
  343. ai_charge, 2, Widow2SaveDisruptLoc,
  344. ai_charge, -20, WidowDisrupt,
  345. ai_charge, 2, NULL,
  346. ai_charge, 2, NULL,
  347. ai_charge, 2, widow2_disrupt_reattack
  348. };
  349. mmove_t widow2_move_attack_disrupt = {FRAME_firea01, FRAME_firea07, widow2_frames_attack_disrupt, widow2_run};
  350. void Widow2SaveBeamTarget (edict_t *self)
  351. {
  352. if (self->enemy && self->enemy->inuse)
  353. {
  354. VectorCopy (self->pos1, self->pos2);
  355. VectorCopy (self->enemy->s.origin, self->pos1); //save for aiming the shot
  356. }
  357. else
  358. {
  359. VectorCopy (vec3_origin, self->pos1);
  360. VectorCopy (vec3_origin, self->pos2);
  361. }
  362. }
  363. void Widow2BeamTargetRemove (edict_t *self)
  364. {
  365. VectorCopy (vec3_origin, self->pos1);
  366. VectorCopy (vec3_origin, self->pos2);
  367. }
  368. void Widow2StartSweep (edict_t *self)
  369. {
  370. Widow2SaveBeamTarget (self);
  371. }
  372. mframe_t widow2_frames_spawn [] =
  373. {
  374. ai_charge, 0, NULL,
  375. ai_charge, 0, NULL,
  376. ai_charge, 0, widow_start_spawn,
  377. ai_charge, 0, Widow2Beam,
  378. ai_charge, 0, Widow2Beam, //5
  379. ai_charge, 0, Widow2Beam,
  380. ai_charge, 0, Widow2Beam,
  381. ai_charge, 0, Widow2Beam,
  382. ai_charge, 0, Widow2Beam,
  383. ai_charge, 0, widow2_ready_spawn, //10
  384. ai_charge, 0, Widow2Beam,
  385. ai_charge, 0, Widow2Beam,
  386. ai_charge, 0, Widow2Beam,
  387. ai_charge, 0, widow2_spawn_check,
  388. ai_charge, 0, NULL, //15
  389. ai_charge, 0, NULL,
  390. ai_charge, 0, NULL,
  391. ai_charge, 0, widow2_reattack_beam
  392. };
  393. mmove_t widow2_move_spawn = {FRAME_spawn01, FRAME_spawn18, widow2_frames_spawn, NULL};
  394. static qboolean widow2_tongue_attack_ok (vec3_t start, vec3_t end, float range)
  395. {
  396. vec3_t dir, angles;
  397. // check for max distance
  398. VectorSubtract (start, end, dir);
  399. if (VectorLength(dir) > range)
  400. return false;
  401. // check for min/max pitch
  402. vectoangles (dir, angles);
  403. if (angles[0] < -180)
  404. angles[0] += 360;
  405. if (fabs(angles[0]) > 30)
  406. return false;
  407. return true;
  408. }
  409. void Widow2Tongue (edict_t *self)
  410. {
  411. vec3_t f, r, u;
  412. vec3_t start, end, dir;
  413. trace_t tr;
  414. AngleVectors (self->s.angles, f, r, u);
  415. G_ProjectSource2 (self->s.origin, offsets[self->s.frame - FRAME_tongs01], f, r, u, start);
  416. VectorCopy (self->enemy->s.origin, end);
  417. if (!widow2_tongue_attack_ok(start, end, 256))
  418. {
  419. end[2] = self->enemy->s.origin[2] + self->enemy->maxs[2] - 8;
  420. if (!widow2_tongue_attack_ok(start, end, 256))
  421. {
  422. end[2] = self->enemy->s.origin[2] + self->enemy->mins[2] + 8;
  423. if (!widow2_tongue_attack_ok(start, end, 256))
  424. return;
  425. }
  426. }
  427. VectorCopy (self->enemy->s.origin, end);
  428. tr = gi.trace (start, NULL, NULL, end, self, MASK_SHOT);
  429. if (tr.ent != self->enemy)
  430. return;
  431. gi.sound (self, CHAN_WEAPON, sound_tentacles_retract, 1, ATTN_NORM, 0);
  432. gi.WriteByte (svc_temp_entity);
  433. gi.WriteByte (TE_PARASITE_ATTACK);
  434. gi.WriteShort (self - g_edicts);
  435. gi.WritePosition (start);
  436. gi.WritePosition (end);
  437. gi.multicast (self->s.origin, MULTICAST_PVS);
  438. VectorSubtract (start, end, dir);
  439. T_Damage (self->enemy, self, self, dir, self->enemy->s.origin, vec3_origin, 2, 0, DAMAGE_NO_KNOCKBACK, MOD_UNKNOWN);
  440. }
  441. void Widow2TonguePull (edict_t *self)
  442. {
  443. vec3_t vec;
  444. float len;
  445. vec3_t f, r, u;
  446. vec3_t start, end;
  447. if ((!self->enemy) || (!self->enemy->inuse))
  448. {
  449. self->monsterinfo.run (self);
  450. return;
  451. }
  452. AngleVectors (self->s.angles, f, r, u);
  453. G_ProjectSource2 (self->s.origin, offsets[self->s.frame - FRAME_tongs01], f, r, u, start);
  454. VectorCopy (self->enemy->s.origin, end);
  455. if (!widow2_tongue_attack_ok(start, end, 256))
  456. {
  457. return;
  458. }
  459. if (self->enemy->groundentity)
  460. {
  461. self->enemy->s.origin[2] += 1;
  462. self->enemy->groundentity = NULL;
  463. // interesting, you don't have to relink the player
  464. }
  465. VectorSubtract (self->s.origin, self->enemy->s.origin, vec);
  466. len = VectorLength (vec);
  467. if (self->enemy->client)
  468. {
  469. VectorNormalize (vec);
  470. VectorMA (self->enemy->velocity, 1000, vec, self->enemy->velocity);
  471. }
  472. else
  473. {
  474. self->enemy->ideal_yaw = vectoyaw(vec);
  475. M_ChangeYaw (self->enemy);
  476. VectorScale (f, 1000, self->enemy->velocity);
  477. }
  478. }
  479. void Widow2Crunch (edict_t *self)
  480. {
  481. vec3_t aim;
  482. if ((!self->enemy) || (!self->enemy->inuse))
  483. {
  484. self->monsterinfo.run (self);
  485. return;
  486. }
  487. Widow2TonguePull (self);
  488. // 70 + 32
  489. VectorSet (aim, 150, 0, 4);
  490. if (self->s.frame != FRAME_tongs07)
  491. fire_hit (self, aim, 20 + (rand() % 6), 0);
  492. else
  493. {
  494. if (self->enemy->groundentity)
  495. fire_hit (self, aim, (20 + (rand() % 6)), 500);
  496. else // not as much kick if they're in the air .. makes it harder to land on her head
  497. fire_hit (self, aim, (20 + (rand() % 6)), 250);
  498. }
  499. }
  500. void Widow2Toss (edict_t *self)
  501. {
  502. self->timestamp = level.time + 3;
  503. return;
  504. }
  505. mframe_t widow2_frames_tongs [] =
  506. {
  507. ai_charge, 0, Widow2Tongue,
  508. ai_charge, 0, Widow2Tongue,
  509. ai_charge, 0, Widow2Tongue,
  510. ai_charge, 0, Widow2TonguePull,
  511. ai_charge, 0, Widow2TonguePull, //5
  512. ai_charge, 0, Widow2TonguePull,
  513. ai_charge, 0, Widow2Crunch,
  514. ai_charge, 0, Widow2Toss
  515. };
  516. mmove_t widow2_move_tongs = {FRAME_tongs01, FRAME_tongs08, widow2_frames_tongs, widow2_run};
  517. mframe_t widow2_frames_pain [] =
  518. {
  519. ai_move, 0, NULL,
  520. ai_move, 0, NULL,
  521. ai_move, 0, NULL,
  522. ai_move, 0, NULL,
  523. ai_move, 0, NULL
  524. };
  525. mmove_t widow2_move_pain = {FRAME_pain01, FRAME_pain05, widow2_frames_pain, widow2_run};
  526. mframe_t widow2_frames_death [] =
  527. {
  528. ai_move, 0, NULL,
  529. ai_move, 0, NULL,
  530. ai_move, 0, WidowExplosion1, // 3 boom
  531. ai_move, 0, NULL,
  532. ai_move, 0, NULL, // 5
  533. ai_move, 0, WidowExplosion2, // 6 boom
  534. ai_move, 0, NULL,
  535. ai_move, 0, NULL,
  536. ai_move, 0, NULL,
  537. ai_move, 0, NULL, // 10
  538. ai_move, 0, NULL,
  539. ai_move, 0, NULL, // 12
  540. ai_move, 0, NULL,
  541. ai_move, 0, NULL,
  542. ai_move, 0, NULL, // 15
  543. ai_move, 0, NULL,
  544. ai_move, 0, NULL,
  545. ai_move, 0, WidowExplosion3, // 18
  546. ai_move, 0, NULL, // 19
  547. ai_move, 0, NULL, // 20
  548. ai_move, 0, NULL,
  549. ai_move, 0, NULL,
  550. ai_move, 0, NULL,
  551. ai_move, 0, NULL,
  552. ai_move, 0, WidowExplosion4, // 25
  553. ai_move, 0, NULL, // 26
  554. ai_move, 0, NULL,
  555. ai_move, 0, NULL,
  556. ai_move, 0, WidowExplosion5,
  557. ai_move, 0, WidowExplosionLeg, // 30
  558. ai_move, 0, NULL,
  559. ai_move, 0, NULL,
  560. ai_move, 0, NULL,
  561. ai_move, 0, WidowExplosion6,
  562. ai_move, 0, NULL, // 35
  563. ai_move, 0, NULL,
  564. ai_move, 0, NULL,
  565. ai_move, 0, WidowExplosion7,
  566. ai_move, 0, NULL,
  567. ai_move, 0, NULL, // 40
  568. ai_move, 0, NULL,
  569. ai_move, 0, NULL,
  570. ai_move, 0, NULL,
  571. ai_move, 0, WidowExplode // 44
  572. };
  573. mmove_t widow2_move_death = {FRAME_death01, FRAME_death44, widow2_frames_death, NULL};
  574. void widow2_start_searching (edict_t *self);
  575. void widow2_keep_searching (edict_t *self);
  576. void widow2_finaldeath (edict_t *self);
  577. mframe_t widow2_frames_dead [] =
  578. {
  579. ai_move, 0, widow2_start_searching,
  580. ai_move, 0, NULL,
  581. ai_move, 0, NULL,
  582. ai_move, 0, NULL,
  583. ai_move, 0, NULL,
  584. ai_move, 0, NULL,
  585. ai_move, 0, NULL,
  586. ai_move, 0, NULL,
  587. ai_move, 0, NULL,
  588. ai_move, 0, NULL,
  589. ai_move, 0, NULL,
  590. ai_move, 0, NULL,
  591. ai_move, 0, NULL,
  592. ai_move, 0, NULL,
  593. ai_move, 0, widow2_keep_searching
  594. };
  595. mmove_t widow2_move_dead = {FRAME_dthsrh01, FRAME_dthsrh15, widow2_frames_dead, NULL};
  596. mframe_t widow2_frames_really_dead [] =
  597. {
  598. ai_move, 0, NULL,
  599. ai_move, 0, NULL,
  600. ai_move, 0, NULL,
  601. ai_move, 0, NULL,
  602. ai_move, 0, NULL,
  603. ai_move, 0, NULL,
  604. ai_move, 0, widow2_finaldeath
  605. };
  606. mmove_t widow2_move_really_dead = {FRAME_dthsrh16, FRAME_dthsrh22, widow2_frames_really_dead, NULL};
  607. void widow2_start_searching (edict_t *self)
  608. {
  609. self->count = 0;
  610. }
  611. void widow2_keep_searching (edict_t *self)
  612. {
  613. if (self->count <= 2)
  614. {
  615. self->monsterinfo.currentmove = &widow2_move_dead;
  616. self->s.frame = FRAME_dthsrh01;
  617. self->count++;
  618. return;
  619. }
  620. self->monsterinfo.currentmove = &widow2_move_really_dead;
  621. }
  622. void widow2_finaldeath (edict_t *self)
  623. {
  624. VectorSet (self->mins, -70, -70, 0);
  625. VectorSet (self->maxs, 70, 70, 80);
  626. self->movetype = MOVETYPE_TOSS;
  627. // self->svflags |= SVF_DEADMONSTER;
  628. self->takedamage = DAMAGE_YES;
  629. self->nextthink = 0;
  630. gi.linkentity (self);
  631. }
  632. void widow2_stand (edict_t *self)
  633. {
  634. // gi.dprintf ("widow2 stand\n");
  635. self->monsterinfo.currentmove = &widow2_move_stand;
  636. }
  637. void widow2_run (edict_t *self)
  638. {
  639. // gi.dprintf ("widow2 run - %2.2f - %s \n", level.time, self->enemy->classname);
  640. self->monsterinfo.aiflags &= ~AI_HOLD_FRAME;
  641. if (self->monsterinfo.aiflags & AI_STAND_GROUND)
  642. self->monsterinfo.currentmove = &widow2_move_stand;
  643. else
  644. self->monsterinfo.currentmove = &widow2_move_run;
  645. }
  646. void widow2_walk (edict_t *self)
  647. {
  648. self->monsterinfo.currentmove = &widow2_move_walk;
  649. }
  650. void widow2_melee (edict_t *self)
  651. {
  652. self->monsterinfo.currentmove = &widow2_move_tongs;
  653. }
  654. void widow2_attack (edict_t *self)
  655. {
  656. float range, luck;
  657. qboolean blocked = false;
  658. if (self->monsterinfo.aiflags & AI_BLOCKED)
  659. {
  660. blocked = true;
  661. self->monsterinfo.aiflags &= ~AI_BLOCKED;
  662. }
  663. // gi.dprintf ("widow2 attack\n");
  664. if (!self->enemy)
  665. return;
  666. if (self->bad_area)
  667. {
  668. if ((random() < 0.75) || (level.time < self->monsterinfo.attack_finished))
  669. self->monsterinfo.currentmove = &widow2_move_attack_pre_beam;
  670. else
  671. {
  672. self->monsterinfo.currentmove = &widow2_move_attack_disrupt;
  673. }
  674. return;
  675. }
  676. WidowCalcSlots(self);
  677. // if we can't see the target, spawn stuff
  678. if ((self->monsterinfo.attack_state == AS_BLIND) && (SELF_SLOTS_LEFT >= 2))
  679. {
  680. self->monsterinfo.currentmove = &widow2_move_spawn;
  681. return;
  682. }
  683. // accept bias towards spawning
  684. if (blocked && (SELF_SLOTS_LEFT >= 2))
  685. {
  686. self->monsterinfo.currentmove = &widow2_move_spawn;
  687. return;
  688. }
  689. range = realrange (self, self->enemy);
  690. if (range < 600)
  691. {
  692. luck = random();
  693. if (SELF_SLOTS_LEFT >= 2)
  694. {
  695. if (luck <= 0.40)
  696. self->monsterinfo.currentmove = &widow2_move_attack_pre_beam;
  697. else if ((luck <= 0.7) && !(level.time < self->monsterinfo.attack_finished))
  698. {
  699. // gi.sound (self, CHAN_WEAPON, sound_disrupt, 1, ATTN_NORM, 0);
  700. self->monsterinfo.currentmove = &widow2_move_attack_disrupt;
  701. }
  702. else
  703. self->monsterinfo.currentmove = &widow2_move_spawn;
  704. }
  705. else
  706. {
  707. if ((luck <= 0.50) || (level.time < self->monsterinfo.attack_finished))
  708. self->monsterinfo.currentmove = &widow2_move_attack_pre_beam;
  709. else
  710. {
  711. // gi.sound (self, CHAN_WEAPON, sound_disrupt, 1, ATTN_NORM, 0);
  712. self->monsterinfo.currentmove = &widow2_move_attack_disrupt;
  713. }
  714. }
  715. }
  716. else
  717. {
  718. luck = random();
  719. if (SELF_SLOTS_LEFT >= 2)
  720. {
  721. if (luck < 0.3)
  722. self->monsterinfo.currentmove = &widow2_move_attack_pre_beam;
  723. else if ((luck < 0.65) || (level.time < self->monsterinfo.attack_finished))
  724. self->monsterinfo.currentmove = &widow2_move_spawn;
  725. else
  726. {
  727. // gi.sound (self, CHAN_WEAPON, sound_disrupt, 1, ATTN_NORM, 0);
  728. self->monsterinfo.currentmove = &widow2_move_attack_disrupt;
  729. }
  730. }
  731. else
  732. {
  733. if ((luck < 0.45) || (level.time < self->monsterinfo.attack_finished))
  734. self->monsterinfo.currentmove = &widow2_move_attack_pre_beam;
  735. else
  736. {
  737. // gi.sound (self, CHAN_WEAPON, sound_disrupt, 1, ATTN_NORM, 0);
  738. self->monsterinfo.currentmove = &widow2_move_attack_disrupt;
  739. }
  740. }
  741. }
  742. }
  743. void widow2_attack_beam (edict_t *self)
  744. {
  745. self->monsterinfo.currentmove = &widow2_move_attack_beam;
  746. }
  747. void widow2_reattack_beam (edict_t *self)
  748. {
  749. self->monsterinfo.aiflags &= ~AI_MANUAL_STEERING;
  750. if ( infront(self, self->enemy) )
  751. if (random() <= 0.5)
  752. if ((random() < 0.7) || (SELF_SLOTS_LEFT < 2))
  753. self->monsterinfo.currentmove = &widow2_move_attack_beam;
  754. else
  755. self->monsterinfo.currentmove = &widow2_move_spawn;
  756. else
  757. self->monsterinfo.currentmove = &widow2_move_attack_post_beam;
  758. else
  759. self->monsterinfo.currentmove = &widow2_move_attack_post_beam;
  760. }
  761. void widow2_pain (edict_t *self, edict_t *other, float kick, int damage)
  762. {
  763. if (self->health < (self->max_health / 2))
  764. self->s.skinnum = 1;
  765. if (skill->value == 3)
  766. return; // no pain anims in nightmare
  767. // gi.dprintf ("widow2 pain\n");
  768. if (level.time < self->pain_debounce_time)
  769. return;
  770. self->pain_debounce_time = level.time + 5;
  771. if (damage < 15)
  772. {
  773. gi.sound (self, CHAN_VOICE, sound_pain1, 1, ATTN_NONE, 0);
  774. }
  775. else if (damage < 75)
  776. {
  777. gi.sound (self, CHAN_VOICE, sound_pain2, 1, ATTN_NONE, 0);
  778. if ((skill->value < 3) && (random() < (0.6 - (0.2*((float)skill->value)))))
  779. {
  780. self->monsterinfo.aiflags &= ~AI_MANUAL_STEERING;
  781. self->monsterinfo.currentmove = &widow2_move_pain;
  782. }
  783. }
  784. else
  785. {
  786. gi.sound (self, CHAN_VOICE, sound_pain3, 1, ATTN_NONE, 0);
  787. if ((skill->value < 3) && (random() < (0.75 - (0.1*((float)skill->value)))))
  788. {
  789. self->monsterinfo.aiflags &= ~AI_MANUAL_STEERING;
  790. self->monsterinfo.currentmove = &widow2_move_pain;
  791. }
  792. }
  793. }
  794. void widow2_dead (edict_t *self)
  795. {
  796. }
  797. void KillChildren (edict_t *self)
  798. {
  799. edict_t *ent;
  800. int field;
  801. ent = NULL;
  802. field = FOFS(classname);
  803. while (1)
  804. {
  805. ent = G_Find (ent, field, "monster_stalker");
  806. if(!ent)
  807. return;
  808. // FIXME - may need to stagger
  809. if ((ent->inuse) && (ent->health > 0))
  810. T_Damage (ent, self, self, vec3_origin, self->enemy->s.origin, vec3_origin, (ent->health + 1), 0, DAMAGE_NO_KNOCKBACK, MOD_UNKNOWN);
  811. }
  812. }
  813. void widow2_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point)
  814. {
  815. int n;
  816. int clipped;
  817. // check for gib
  818. if (self->health <= self->gib_health)
  819. {
  820. clipped = min (damage, 100);
  821. gi.sound (self, CHAN_VOICE, gi.soundindex ("misc/udeath.wav"), 1, ATTN_NORM, 0);
  822. for (n= 0; n < 2; n++)
  823. ThrowWidowGibLoc (self, "models/objects/gibs/bone/tris.md2", clipped, GIB_ORGANIC, NULL, false);
  824. for (n= 0; n < 3; n++)
  825. ThrowWidowGibLoc (self, "models/objects/gibs/sm_meat/tris.md2", clipped, GIB_ORGANIC, NULL, false);
  826. for (n= 0; n < 3; n++)
  827. {
  828. ThrowWidowGibSized (self, "models/monsters/blackwidow2/gib1/tris.md2", clipped, GIB_METALLIC, NULL,
  829. 0, false);
  830. ThrowWidowGibSized (self, "models/monsters/blackwidow2/gib2/tris.md2", clipped, GIB_METALLIC, NULL,
  831. gi.soundindex ("misc/fhit3.wav"), false);
  832. }
  833. for (n= 0; n < 2; n++)
  834. {
  835. ThrowWidowGibSized (self, "models/monsters/blackwidow2/gib3/tris.md2", clipped, GIB_METALLIC, NULL,
  836. 0, false);
  837. ThrowWidowGibSized (self, "models/monsters/blackwidow/gib3/tris.md2", clipped, GIB_METALLIC, NULL,
  838. 0, false);
  839. }
  840. ThrowGib (self, "models/objects/gibs/chest/tris.md2", clipped, GIB_ORGANIC);
  841. ThrowHead (self, "models/objects/gibs/head2/tris.md2", clipped, GIB_ORGANIC);
  842. self->deadflag = DEAD_DEAD;
  843. return;
  844. }
  845. if (self->deadflag == DEAD_DEAD)
  846. return;
  847. gi.sound (self, CHAN_VOICE, sound_death, 1, ATTN_NONE, 0);
  848. self->deadflag = DEAD_DEAD;
  849. self->takedamage = DAMAGE_NO;
  850. self->count = 0;
  851. KillChildren (self);
  852. self->monsterinfo.quad_framenum = 0;
  853. self->monsterinfo.double_framenum = 0;
  854. self->monsterinfo.invincible_framenum = 0;
  855. self->monsterinfo.currentmove = &widow2_move_death;
  856. }
  857. qboolean Widow2_CheckAttack (edict_t *self)
  858. {
  859. vec3_t spot1, spot2;
  860. vec3_t temp;
  861. float chance;
  862. trace_t tr;
  863. qboolean enemy_infront;
  864. int enemy_range;
  865. float enemy_yaw;
  866. float real_enemy_range;
  867. vec3_t f, r, u;
  868. if (!self->enemy)
  869. return false;
  870. WidowPowerups(self);
  871. if ((random() < 0.8) && (SELF_SLOTS_LEFT >= 2) && (realrange(self, self->enemy) > 150))
  872. {
  873. self->monsterinfo.aiflags |= AI_BLOCKED;
  874. self->monsterinfo.attack_state = AS_MISSILE;
  875. return true;
  876. }
  877. if (self->enemy->health > 0)
  878. {
  879. // see if any entities are in the way of the shot
  880. VectorCopy (self->s.origin, spot1);
  881. spot1[2] += self->viewheight;
  882. VectorCopy (self->enemy->s.origin, spot2);
  883. spot2[2] += self->enemy->viewheight;
  884. tr = gi.trace (spot1, NULL, NULL, spot2, self, CONTENTS_SOLID|CONTENTS_MONSTER|CONTENTS_SLIME|CONTENTS_LAVA);
  885. // do we have a clear shot?
  886. if (tr.ent != self->enemy)
  887. {
  888. // go ahead and spawn stuff if we're mad a a client
  889. if (self->enemy->client && SELF_SLOTS_LEFT >= 2)
  890. {
  891. self->monsterinfo.attack_state = AS_BLIND;
  892. return true;
  893. }
  894. // PGM - we want them to go ahead and shoot at info_notnulls if they can.
  895. if(self->enemy->solid != SOLID_NOT || tr.fraction < 1.0) //PGM
  896. return false;
  897. }
  898. }
  899. enemy_infront = infront(self, self->enemy);
  900. enemy_range = range(self, self->enemy);
  901. VectorSubtract (self->enemy->s.origin, self->s.origin, temp);
  902. enemy_yaw = vectoyaw2(temp);
  903. self->ideal_yaw = enemy_yaw;
  904. // melee attack
  905. if (self->timestamp < level.time)
  906. {
  907. real_enemy_range = realrange (self, self->enemy);
  908. if (real_enemy_range < 300)
  909. {
  910. AngleVectors (self->s.angles, f, r, u);
  911. G_ProjectSource2 (self->s.origin, offsets[0], f, r, u, spot1);
  912. VectorCopy (self->enemy->s.origin, spot2);
  913. if (widow2_tongue_attack_ok(spot1, spot2, 256))
  914. {
  915. // melee attack ok
  916. // be nice in easy mode
  917. if (skill->value == 0 && (rand()&3) )
  918. return false;
  919. if (self->monsterinfo.melee)
  920. self->monsterinfo.attack_state = AS_MELEE;
  921. else
  922. self->monsterinfo.attack_state = AS_MISSILE;
  923. return true;
  924. }
  925. }
  926. }
  927. if (level.time < self->monsterinfo.attack_finished)
  928. return false;
  929. if (self->monsterinfo.aiflags & AI_STAND_GROUND)
  930. {
  931. chance = 0.4;
  932. }
  933. else if (enemy_range == RANGE_NEAR)
  934. {
  935. chance = 0.8;
  936. }
  937. else if (enemy_range == RANGE_MID)
  938. {
  939. chance = 0.8;
  940. }
  941. else if (enemy_range == RANGE_FAR)
  942. {
  943. chance = 0.5;
  944. }
  945. // PGM - go ahead and shoot every time if it's a info_notnull
  946. if ((random () < chance) || (self->enemy->solid == SOLID_NOT))
  947. {
  948. self->monsterinfo.attack_state = AS_MISSILE;
  949. // self->monsterinfo.attack_finished = level.time + 1.0 + 2*random();
  950. return true;
  951. }
  952. return false;
  953. }
  954. void Widow2Precache ()
  955. {
  956. // cache in all of the stalker stuff, widow stuff, spawngro stuff, gibs
  957. gi.soundindex ("parasite/parpain1.wav");
  958. gi.soundindex ("parasite/parpain2.wav");
  959. gi.soundindex ("parasite/pardeth1.wav");
  960. gi.soundindex ("parasite/paratck1.wav");
  961. gi.soundindex ("parasite/parsght1.wav");
  962. gi.soundindex ("infantry/melee2.wav");
  963. gi.soundindex ("misc/fhit3.wav");
  964. gi.soundindex ("tank/tnkatck3.wav");
  965. gi.soundindex ("weapons/disrupt.wav");
  966. gi.soundindex ("weapons/disint2.wav");
  967. gi.modelindex ("models/monsters/stalker/tris.md2");
  968. gi.modelindex ("models/items/spawngro2/tris.md2");
  969. gi.modelindex ("models/objects/gibs/sm_metal/tris.md2");
  970. gi.modelindex ("models/proj/laser2/tris.md2");
  971. gi.modelindex ("models/proj/disintegrator/tris.md2");
  972. gi.modelindex ("models/monsters/blackwidow/gib1/tris.md2");
  973. gi.modelindex ("models/monsters/blackwidow/gib2/tris.md2");
  974. gi.modelindex ("models/monsters/blackwidow/gib3/tris.md2");
  975. gi.modelindex ("models/monsters/blackwidow/gib4/tris.md2");
  976. gi.modelindex ("models/monsters/blackwidow2/gib1/tris.md2");
  977. gi.modelindex ("models/monsters/blackwidow2/gib2/tris.md2");
  978. gi.modelindex ("models/monsters/blackwidow2/gib3/tris.md2");
  979. gi.modelindex ("models/monsters/blackwidow2/gib4/tris.md2");
  980. }
  981. /*QUAKED monster_widow2 (1 .5 0) (-70 -70 0) (70 70 144) Ambush Trigger_Spawn Sight
  982. */
  983. void SP_monster_widow2 (edict_t *self)
  984. {
  985. if (deathmatch->value)
  986. {
  987. G_FreeEdict (self);
  988. return;
  989. }
  990. sound_pain1 = gi.soundindex ("widow/bw2pain1.wav");
  991. sound_pain2 = gi.soundindex ("widow/bw2pain2.wav");
  992. sound_pain3 = gi.soundindex ("widow/bw2pain3.wav");
  993. sound_death = gi.soundindex ("widow/death.wav");
  994. sound_search1 = gi.soundindex ("bosshovr/bhvunqv1.wav");
  995. // sound_disrupt = gi.soundindex ("gladiator/railgun.wav");
  996. sound_tentacles_retract = gi.soundindex ("brain/brnatck3.wav");
  997. // self->s.sound = gi.soundindex ("bosshovr/bhvengn1.wav");
  998. self->movetype = MOVETYPE_STEP;
  999. self->solid = SOLID_BBOX;
  1000. self->s.modelindex = gi.modelindex ("models/monsters/blackwidow2/tris.md2");
  1001. VectorSet (self->mins, -70, -70, 0);
  1002. VectorSet (self->maxs, 70, 70, 144);
  1003. self->health = 2000 + 800 + 1000*(skill->value);
  1004. if (coop->value)
  1005. self->health += 500*(skill->value);
  1006. // self->health = 1;
  1007. self->gib_health = -900;
  1008. self->mass = 2500;
  1009. /* if (skill->value == 2)
  1010. {
  1011. self->monsterinfo.power_armor_type = POWER_ARMOR_SHIELD;
  1012. self->monsterinfo.power_armor_power = 500;
  1013. }
  1014. else */if (skill->value == 3)
  1015. {
  1016. self->monsterinfo.power_armor_type = POWER_ARMOR_SHIELD;
  1017. self->monsterinfo.power_armor_power = 750;
  1018. }
  1019. self->yaw_speed = 30;
  1020. self->flags |= FL_IMMUNE_LASER;
  1021. self->monsterinfo.aiflags |= AI_IGNORE_SHOTS;
  1022. self->pain = widow2_pain;
  1023. self->die = widow2_die;
  1024. self->monsterinfo.melee = widow2_melee;
  1025. self->monsterinfo.stand = widow2_stand;
  1026. self->monsterinfo.walk = widow2_walk;
  1027. self->monsterinfo.run = widow2_run;
  1028. self->monsterinfo.attack = widow2_attack;
  1029. self->monsterinfo.search = widow2_search;
  1030. self->monsterinfo.checkattack = Widow2_CheckAttack;
  1031. gi.linkentity (self);
  1032. self->monsterinfo.currentmove = &widow2_move_stand;
  1033. self->monsterinfo.scale = MODEL_SCALE;
  1034. Widow2Precache();
  1035. WidowCalcSlots(self);
  1036. walkmonster_start (self);
  1037. }
  1038. //
  1039. // Death sequence stuff
  1040. //
  1041. void WidowVelocityForDamage (int damage, vec3_t v)
  1042. {
  1043. v[0] = damage * crandom();
  1044. v[1] = damage * crandom();
  1045. v[2] = damage * crandom() + 200.0;
  1046. }
  1047. void widow_gib_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf)
  1048. {
  1049. self->solid = SOLID_NOT;
  1050. self->touch = NULL;
  1051. self->s.angles[PITCH] = 0;
  1052. self->s.angles[ROLL] = 0;
  1053. VectorClear (self->avelocity);
  1054. if (self->plat2flags)
  1055. gi.sound (self, CHAN_VOICE, self->plat2flags, 1, ATTN_NORM, 0);
  1056. /*
  1057. if (plane)
  1058. {
  1059. if (plane->normal[2] < -0.8)
  1060. {
  1061. gi.sound (self, CHAN_VOICE, gi.soundindex ("misc/fhit3.wav"), 1, ATTN_NORM, 0);
  1062. }
  1063. //vectoangles (plane->normal, normal_angles);
  1064. //AngleVectors (normal_angles, NULL, right, NULL);
  1065. //vectoangles (right, self->s.angles);
  1066. //VectorClear (self->avelocity);
  1067. }
  1068. */
  1069. }
  1070. void ThrowWidowGib (edict_t *self, char *gibname, int damage, int type)
  1071. {
  1072. ThrowWidowGibReal (self, gibname, damage, type, NULL, false, 0, true);
  1073. }
  1074. void ThrowWidowGibLoc (edict_t *self, char *gibname, int damage, int type, vec3_t startpos, qboolean fade)
  1075. {
  1076. ThrowWidowGibReal (self, gibname, damage, type, startpos, false, 0, fade);
  1077. }
  1078. void ThrowWidowGibSized (edict_t *self, char *gibname, int damage, int type, vec3_t startpos, int hitsound, qboolean fade)
  1079. {
  1080. ThrowWidowGibReal (self, gibname, damage, type, startpos, true, hitsound, fade);
  1081. }
  1082. void ThrowWidowGibReal (edict_t *self, char *gibname, int damage, int type, vec3_t startpos, qboolean sized, int hitsound, qboolean fade)
  1083. {
  1084. edict_t *gib;
  1085. vec3_t vd;
  1086. vec3_t origin;
  1087. vec3_t size;
  1088. float vscale;
  1089. if (!gibname)
  1090. return;
  1091. gib = G_Spawn();
  1092. if (startpos)
  1093. VectorCopy (startpos, gib->s.origin);
  1094. else
  1095. {
  1096. VectorScale (self->size, 0.5, size);
  1097. VectorAdd (self->absmin, size, origin);
  1098. gib->s.origin[0] = origin[0] + crandom() * size[0];
  1099. gib->s.origin[1] = origin[1] + crandom() * size[1];
  1100. gib->s.origin[2] = origin[2] + crandom() * size[2];
  1101. }
  1102. gib->solid = SOLID_NOT;
  1103. gib->s.effects |= EF_GIB;
  1104. gib->flags |= FL_NO_KNOCKBACK;
  1105. gib->takedamage = DAMAGE_YES;
  1106. gib->die = gib_die;
  1107. gib->s.renderfx |= RF_IR_VISIBLE;
  1108. if (fade)
  1109. {
  1110. gib->think = G_FreeEdict;
  1111. // sized gibs last longer
  1112. if (sized)
  1113. gib->nextthink = level.time + 20 + random()*15;
  1114. else
  1115. gib->nextthink = level.time + 5 + random()*10;
  1116. }
  1117. else
  1118. {
  1119. gib->think = G_FreeEdict;
  1120. // sized gibs last longer
  1121. if (sized)
  1122. gib->nextthink = level.time + 60 + random()*15;
  1123. else
  1124. gib->nextthink = level.time + 25 + random()*10;
  1125. }
  1126. if (type == GIB_ORGANIC)
  1127. {
  1128. gib->movetype = MOVETYPE_TOSS;
  1129. gib->touch = gib_touch;
  1130. vscale = 0.5;
  1131. }
  1132. else
  1133. {
  1134. gib->movetype = MOVETYPE_BOUNCE;
  1135. vscale = 1.0;
  1136. }
  1137. WidowVelocityForDamage (damage, vd);
  1138. VectorMA (self->velocity, vscale, vd, gib->velocity);
  1139. ClipGibVelocity (gib);
  1140. gi.setmodel (gib, gibname);
  1141. if (sized)
  1142. {
  1143. gib->plat2flags = hitsound;
  1144. gib->solid = SOLID_BBOX;
  1145. gib->avelocity[0] = random()*400;
  1146. gib->avelocity[1] = random()*400;
  1147. gib->avelocity[2] = random()*200;
  1148. if (gib->velocity[2] < 0)
  1149. gib->velocity[2] *= -1;
  1150. gib->velocity[0] *= 2;
  1151. gib->velocity[1] *= 2;
  1152. ClipGibVelocity (gib);
  1153. gib->velocity[2] = max((350 + (random()*100.0)), gib->velocity[2]);
  1154. gib->gravity = 0.25;
  1155. gib->touch = widow_gib_touch;
  1156. gib->owner = self;
  1157. if (gib->s.modelindex == gi.modelindex ("models/monsters/blackwidow2/gib2/tris.md2"))
  1158. {
  1159. VectorSet (gib->mins, -10, -10, 0);
  1160. VectorSet (gib->maxs, 10, 10, 10);
  1161. }
  1162. else
  1163. {
  1164. VectorSet (gib->mins, -5, -5, 0);
  1165. VectorSet (gib->maxs, 5, 5, 5);
  1166. }
  1167. }
  1168. else
  1169. {
  1170. gib->velocity[0] *= 2;
  1171. gib->velocity[1] *= 2;
  1172. gib->avelocity[0] = random()*600;
  1173. gib->avelocity[1] = random()*600;
  1174. gib->avelocity[2] = random()*600;
  1175. }
  1176. // gib->think = G_FreeEdict;
  1177. // gib->nextthink = level.time + 10 + random()*10;
  1178. gi.linkentity (gib);
  1179. }
  1180. void BloodFountain (edict_t *self, int number, vec3_t startpos, int damage)
  1181. {
  1182. int n;
  1183. vec3_t vd;
  1184. vec3_t origin, size, velocity;
  1185. return;
  1186. for (n= 0; n < number; n++)
  1187. {
  1188. if (startpos)
  1189. VectorCopy (startpos, origin);
  1190. else
  1191. {
  1192. VectorScale (self->size, 0.5, size);
  1193. VectorAdd (self->absmin, size, origin);
  1194. origin[0] = origin[0] + crandom() * size[0];
  1195. origin[1] = origin[1] + crandom() * size[1];
  1196. origin[2] = origin[2] + crandom() * size[2];
  1197. }
  1198. WidowVelocityForDamage (damage, vd);
  1199. VectorMA (self->velocity, 1.0, vd, velocity);
  1200. velocity[0] *= 2;
  1201. velocity[1] *= 2;
  1202. // gi.WriteByte (svc_temp_entity);
  1203. // gi.WriteByte (TE_BLOOD_FOUNTAIN);
  1204. // gi.WritePosition (origin);
  1205. // gi.WritePosition (velocity);
  1206. // gi.WriteShort (50);
  1207. // gi.multicast (self->s.origin, MULTICAST_ALL);
  1208. }
  1209. }
  1210. void ThrowSmallStuff (edict_t *self, vec3_t point)
  1211. {
  1212. int n;
  1213. for (n= 0; n < 2; n++)
  1214. ThrowWidowGibLoc (self, "models/objects/gibs/sm_meat/tris.md2", 300, GIB_ORGANIC, point, false);
  1215. ThrowWidowGibLoc (self, "models/objects/gibs/sm_metal/tris.md2", 300, GIB_METALLIC, point, false);
  1216. ThrowWidowGibLoc (self, "models/objects/gibs/sm_metal/tris.md2", 100, GIB_METALLIC, point, false);
  1217. }
  1218. void ThrowMoreStuff (edict_t *self, vec3_t point)
  1219. {
  1220. int n;
  1221. if (coop && coop->value)
  1222. {
  1223. ThrowSmallStuff (self, point);
  1224. return;
  1225. }
  1226. for (n= 0; n < 1; n++)
  1227. ThrowWidowGibLoc (self, "models/objects/gibs/sm_meat/tris.md2", 300, GIB_ORGANIC, point, false);
  1228. for (n= 0; n < 2; n++)
  1229. ThrowWidowGibLoc (self, "models/objects/gibs/sm_metal/tris.md2", 300, GIB_METALLIC, point, false);
  1230. for (n= 0; n < 3; n++)
  1231. ThrowWidowGibLoc (self, "models/objects/gibs/sm_metal/tris.md2", 100, GIB_METALLIC, point, false);
  1232. }
  1233. void WidowExplode (edict_t *self)
  1234. {
  1235. vec3_t org;
  1236. int n;
  1237. self->think = WidowExplode;
  1238. // gi.dprintf ("count = %d\n");
  1239. //redo:
  1240. VectorCopy (self->s.origin, org);
  1241. org[2] += 24 + (rand()&15);
  1242. if (self->count < 8)
  1243. org[2] += 24 + (rand()&31);
  1244. switch (self->count)
  1245. {
  1246. case 0:
  1247. org[0] -= 24;
  1248. org[1] -= 24;
  1249. break;
  1250. case 1:
  1251. org[0] += 24;
  1252. org[1] += 24;
  1253. ThrowSmallStuff(self, org);
  1254. break;
  1255. case 2:
  1256. org[0] += 24;
  1257. org[1] -= 24;
  1258. break;
  1259. case 3:
  1260. org[0] -= 24;
  1261. org[1] += 24;
  1262. ThrowMoreStuff(self, org);
  1263. break;
  1264. case 4:
  1265. org[0] -= 48;
  1266. org[1] -= 48;
  1267. break;
  1268. case 5:
  1269. org[0] += 48;
  1270. org[1] += 48;
  1271. ThrowArm1 (self);
  1272. break;
  1273. case 6:
  1274. org[0] -= 48;
  1275. org[1] += 48;
  1276. ThrowArm2 (self);
  1277. break;
  1278. case 7:
  1279. org[0] += 48;
  1280. org[1] -= 48;
  1281. ThrowSmallStuff(self, org);
  1282. break;
  1283. case 8:
  1284. org[0] += 18;
  1285. org[1] += 18;
  1286. org[2] = self->s.origin[2] + 48;
  1287. ThrowMoreStuff(self, org);
  1288. break;
  1289. case 9:
  1290. org[0] -= 18;
  1291. org[1] += 18;
  1292. org[2] = self->s.origin[2] + 48;
  1293. break;
  1294. case 10:
  1295. org[0] += 18;
  1296. org[1] -= 18;
  1297. org[2] = self->s.origin[2] + 48;
  1298. break;
  1299. case 11:
  1300. org[0] -= 18;
  1301. org[1] -= 18;
  1302. org[2] = self->s.origin[2] + 48;
  1303. break;
  1304. case 12:
  1305. self->s.sound = 0;
  1306. for (n= 0; n < 1; n++)
  1307. ThrowWidowGib (self, "models/objects/gibs/sm_meat/tris.md2", 400, GIB_ORGANIC);
  1308. for (n= 0; n < 2; n++)
  1309. ThrowWidowGib (self, "models/objects/gibs/sm_metal/tris.md2", 100, GIB_METALLIC);
  1310. for (n= 0; n < 2; n++)
  1311. ThrowWidowGib (self, "models/objects/gibs/sm_metal/tris.md2", 400, GIB_METALLIC);
  1312. // ThrowGib (self, "models/objects/gibs/chest/tris.md2", 1000, GIB_ORGANIC);
  1313. // ThrowHead (self, "models/objects/gibs/gear/tris.md2", 1000, GIB_METALLIC);
  1314. self->deadflag = DEAD_DEAD;
  1315. self->think = monster_think;
  1316. self->nextthink = level.time + 0.1;
  1317. self->monsterinfo.currentmove = &widow2_move_dead;
  1318. return;
  1319. }
  1320. self->count++;
  1321. if (self->count >=9 && self->count <=12)
  1322. {
  1323. gi.WriteByte (svc_temp_entity);
  1324. gi.WriteByte (TE_EXPLOSION1_BIG);
  1325. gi.WritePosition (org);
  1326. gi.multicast (self->s.origin, MULTICAST_ALL);
  1327. // goto redo;
  1328. }
  1329. else
  1330. {
  1331. // else
  1332. gi.WriteByte (svc_temp_entity);
  1333. if (self->count %2)
  1334. gi.WriteByte (TE_EXPLOSION1);
  1335. else
  1336. gi.WriteByte (TE_EXPLOSION1_NP);
  1337. gi.WritePosition (org);
  1338. gi.multicast (self->s.origin, MULTICAST_ALL);
  1339. }
  1340. self->nextthink = level.time + 0.1;
  1341. }
  1342. void WidowExplosion1 (edict_t *self)
  1343. {
  1344. int n;
  1345. vec3_t f,r,u, startpoint;
  1346. vec3_t offset = {23.74, -37.67, 76.96};
  1347. // gi.dprintf ("1\n");
  1348. AngleVectors (self->s.angles, f, r, u);
  1349. G_ProjectSource2 (self->s.origin, offset, f, r, u, startpoint);
  1350. gi.WriteByte (svc_temp_entity);
  1351. gi.WriteByte (TE_EXPLOSION1);
  1352. gi.WritePosition (startpoint);
  1353. gi.multicast (self->s.origin, MULTICAST_ALL);
  1354. for (n= 0; n < 1; n++)
  1355. ThrowWidowGibLoc (self, "models/objects/gibs/sm_meat/tris.md2", 300, GIB_ORGANIC, startpoint, false);
  1356. for (n= 0; n < 1; n++)
  1357. ThrowWidowGibLoc (self, "models/objects/gibs/sm_metal/tris.md2", 100, GIB_METALLIC, startpoint, false);
  1358. for (n= 0; n < 2; n++)
  1359. ThrowWidowGibLoc (self, "models/objects/gibs/sm_metal/tris.md2", 300, GIB_METALLIC, startpoint, false);
  1360. }
  1361. void WidowExplosion2 (edict_t *self)
  1362. {
  1363. int n;
  1364. vec3_t f,r,u, startpoint;
  1365. vec3_t offset = {-20.49, 36.92, 73.52};
  1366. // gi.dprintf ("2\n");
  1367. AngleVectors (self->s.angles, f, r, u);
  1368. G_ProjectSource2 (self->s.origin, offset, f, r, u, startpoint);
  1369. gi.WriteByte (svc_temp_entity);
  1370. gi.WriteByte (TE_EXPLOSION1);
  1371. gi.WritePosition (startpoint);
  1372. gi.multicast (self->s.origin, MULTICAST_ALL);
  1373. for (n= 0; n < 1; n++)
  1374. ThrowWidowGibLoc (self, "models/objects/gibs/sm_meat/tris.md2", 300, GIB_ORGANIC, startpoint, false);
  1375. for (n= 0; n < 1; n++)
  1376. ThrowWidowGibLoc (self, "models/objects/gibs/sm_metal/tris.md2", 100, GIB_METALLIC, startpoint, false);
  1377. for (n= 0; n < 2; n++)
  1378. ThrowWidowGibLoc (self, "models/objects/gibs/sm_metal/tris.md2", 300, GIB_METALLIC, startpoint, false);
  1379. }
  1380. void WidowExplosion3 (edict_t *self)
  1381. {
  1382. int n;
  1383. vec3_t f,r,u, startpoint;
  1384. vec3_t offset = {2.11, 0.05, 92.20};
  1385. // gi.dprintf ("3\n");
  1386. AngleVectors (self->s.angles, f, r, u);
  1387. G_ProjectSource2 (self->s.origin, offset, f, r, u, startpoint);
  1388. gi.WriteByte (svc_temp_entity);
  1389. gi.WriteByte (TE_EXPLOSION1);
  1390. gi.WritePosition (startpoint);
  1391. gi.multicast (self->s.origin, MULTICAST_ALL);
  1392. for (n= 0; n < 1; n++)
  1393. ThrowWidowGibLoc (self, "models/objects/gibs/sm_meat/tris.md2", 300, GIB_ORGANIC, startpoint, false);
  1394. for (n= 0; n < 1; n++)
  1395. ThrowWidowGibLoc (self, "models/objects/gibs/sm_metal/tris.md2", 100, GIB_METALLIC, startpoint, false);
  1396. for (n= 0; n < 2; n++)
  1397. ThrowWidowGibLoc (self, "models/objects/gibs/sm_metal/tris.md2", 300, GIB_METALLIC, startpoint, false);
  1398. }
  1399. void WidowExplosion4 (edict_t *self)
  1400. {
  1401. int n;
  1402. vec3_t f,r,u, startpoint;
  1403. vec3_t offset = {-28.04, -35.57, -77.56};
  1404. // gi.dprintf ("4\n");
  1405. AngleVectors (self->s.angles, f, r, u);
  1406. G_ProjectSource2 (self->s.origin, offset, f, r, u, startpoint);
  1407. gi.WriteByte (svc_temp_entity);
  1408. gi.WriteByte (TE_EXPLOSION1);
  1409. gi.WritePosition (startpoint);
  1410. gi.multicast (self->s.origin, MULTICAST_ALL);
  1411. for (n= 0; n < 1; n++)
  1412. ThrowWidowGibLoc (self, "models/objects/gibs/sm_meat/tris.md2", 300, GIB_ORGANIC, startpoint, false);
  1413. for (n= 0; n < 1; n++)
  1414. ThrowWidowGibLoc (self, "models/objects/gibs/sm_metal/tris.md2", 100, GIB_METALLIC, startpoint, false);
  1415. for (n= 0; n < 2; n++)
  1416. ThrowWidowGibLoc (self, "models/objects/gibs/sm_metal/tris.md2", 300, GIB_METALLIC, startpoint, false);
  1417. }
  1418. void WidowExplosion5 (edict_t *self)
  1419. {
  1420. int n;
  1421. vec3_t f,r,u, startpoint;
  1422. vec3_t offset = {-20.11, -1.11, 40.76};
  1423. // gi.dprintf ("5\n");
  1424. AngleVectors (self->s.angles, f, r, u);
  1425. G_ProjectSource2 (self->s.origin, offset, f, r, u, startpoint);
  1426. gi.WriteByte (svc_temp_entity);
  1427. gi.WriteByte (TE_EXPLOSION1);
  1428. gi.WritePosition (startpoint);
  1429. gi.multicast (self->s.origin, MULTICAST_ALL);
  1430. for (n= 0; n < 1; n++)
  1431. ThrowWidowGibLoc (self, "models/objects/gibs/sm_meat/tris.md2", 300, GIB_ORGANIC, startpoint, false);
  1432. for (n= 0; n < 1; n++)
  1433. ThrowWidowGibLoc (self, "models/objects/gibs/sm_metal/tris.md2", 100, GIB_METALLIC, startpoint, false);
  1434. for (n= 0; n < 2; n++)
  1435. ThrowWidowGibLoc (self, "models/objects/gibs/sm_metal/tris.md2", 300, GIB_METALLIC, startpoint, false);
  1436. }
  1437. void WidowExplosion6 (edict_t *self)
  1438. {
  1439. int n;
  1440. vec3_t f,r,u, startpoint;
  1441. vec3_t offset = {-20.11, -1.11, 40.76};
  1442. //gi.dprintf ("6\n");
  1443. AngleVectors (self->s.angles, f, r, u);
  1444. G_ProjectSource2 (self->s.origin, offset, f, r, u, startpoint);
  1445. gi.WriteByte (svc_temp_entity);
  1446. gi.WriteByte (TE_EXPLOSION1);
  1447. gi.WritePosition (startpoint);
  1448. gi.multicast (self->s.origin, MULTICAST_ALL);
  1449. for (n= 0; n < 1; n++)
  1450. ThrowWidowGibLoc (self, "models/objects/gibs/sm_meat/tris.md2", 300, GIB_ORGANIC, startpoint, false);
  1451. for (n= 0; n < 1; n++)
  1452. ThrowWidowGibLoc (self, "models/objects/gibs/sm_metal/tris.md2", 100, GIB_METALLIC, startpoint, false);
  1453. for (n= 0; n < 2; n++)
  1454. ThrowWidowGibLoc (self, "models/objects/gibs/sm_metal/tris.md2", 300, GIB_METALLIC, startpoint, false);
  1455. }
  1456. void WidowExplosion7 (edict_t *self)
  1457. {
  1458. int n;
  1459. vec3_t f,r,u, startpoint;
  1460. vec3_t offset = {-20.11, -1.11, 40.76};
  1461. //gi.dprintf ("7\n");
  1462. AngleVectors (self->s.angles, f, r, u);
  1463. G_ProjectSource2 (self->s.origin, offset, f, r, u, startpoint);
  1464. gi.WriteByte (svc_temp_entity);
  1465. gi.WriteByte (TE_EXPLOSION1);
  1466. gi.WritePosition (startpoint);
  1467. gi.multicast (self->s.origin, MULTICAST_ALL);
  1468. for (n= 0; n < 1; n++)
  1469. ThrowWidowGibLoc (self, "models/objects/gibs/sm_meat/tris.md2", 300, GIB_ORGANIC, startpoint, false);
  1470. for (n= 0; n < 1; n++)
  1471. ThrowWidowGibLoc (self, "models/objects/gibs/sm_metal/tris.md2", 100, GIB_METALLIC, startpoint, false);
  1472. for (n= 0; n < 2; n++)
  1473. ThrowWidowGibLoc (self, "models/objects/gibs/sm_metal/tris.md2", 300, GIB_METALLIC, startpoint, false);
  1474. }
  1475. void WidowExplosionLeg (edict_t *self)
  1476. {
  1477. // int n;
  1478. vec3_t f,r,u, startpoint;
  1479. vec3_t offset1 = {-31.89, -47.86, 67.02};
  1480. vec3_t offset2 = {-44.9, -82.14, 54.72};
  1481. //gi.dprintf ("Leg\n");
  1482. AngleVectors (self->s.angles, f, r, u);
  1483. G_ProjectSource2 (self->s.origin, offset1, f, r, u, startpoint);
  1484. gi.WriteByte (svc_temp_entity);
  1485. gi.WriteByte (TE_EXPLOSION1_BIG);
  1486. gi.WritePosition (startpoint);
  1487. gi.multicast (self->s.origin, MULTICAST_ALL);
  1488. ThrowWidowGibSized (self, "models/monsters/blackwidow2/gib2/tris.md2", 200, GIB_METALLIC, startpoint,
  1489. gi.soundindex ("misc/fhit3.wav"), false);
  1490. ThrowWidowGibLoc (self, "models/objects/gibs/sm_meat/tris.md2", 300, GIB_ORGANIC, startpoint, false);
  1491. ThrowWidowGibLoc (self, "models/objects/gibs/sm_metal/tris.md2", 100, GIB_METALLIC, startpoint, false);
  1492. G_ProjectSource2 (self->s.origin, offset2, f, r, u, startpoint);
  1493. gi.WriteByte (svc_temp_entity);
  1494. gi.WriteByte (TE_EXPLOSION1);
  1495. gi.WritePosition (startpoint);
  1496. gi.multicast (self->s.origin, MULTICAST_ALL);
  1497. ThrowWidowGibSized (self, "models/monsters/blackwidow2/gib1/tris.md2", 300, GIB_METALLIC, startpoint,
  1498. gi.soundindex ("misc/fhit3.wav"), false);
  1499. ThrowWidowGibLoc (self, "models/objects/gibs/sm_meat/tris.md2", 300, GIB_ORGANIC, startpoint, false);
  1500. ThrowWidowGibLoc (self, "models/objects/gibs/sm_metal/tris.md2", 100, GIB_METALLIC, startpoint, false);
  1501. }
  1502. void ThrowArm1 (edict_t *self)
  1503. {
  1504. int n;
  1505. vec3_t f,r,u, startpoint;
  1506. vec3_t offset1 = {65.76, 17.52, 7.56};
  1507. AngleVectors (self->s.angles, f, r, u);
  1508. G_ProjectSource2 (self->s.origin, offset1, f, r, u, startpoint);
  1509. gi.WriteByte (svc_temp_entity);
  1510. gi.WriteByte (TE_EXPLOSION1_BIG);
  1511. gi.WritePosition (startpoint);
  1512. gi.multicast (self->s.origin, MULTICAST_ALL);
  1513. for (n= 0; n < 2; n++)
  1514. ThrowWidowGibLoc (self, "models/objects/gibs/sm_metal/tris.md2", 100, GIB_METALLIC, startpoint, false);
  1515. }
  1516. void ThrowArm2 (edict_t *self)
  1517. {
  1518. // int n;
  1519. vec3_t f,r,u, startpoint;
  1520. vec3_t offset1 = {65.76, 17.52, 7.56};
  1521. AngleVectors (self->s.angles, f, r, u);
  1522. G_ProjectSource2 (self->s.origin, offset1, f, r, u, startpoint);
  1523. ThrowWidowGibSized (self, "models/monsters/blackwidow2/gib4/tris.md2", 200, GIB_METALLIC, startpoint,
  1524. gi.soundindex ("misc/fhit3.wav"), false);
  1525. ThrowWidowGibLoc (self, "models/objects/gibs/sm_meat/tris.md2", 300, GIB_ORGANIC, startpoint, false);
  1526. }