zombie.qc 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534
  1. /* Copyright (C) 1996-1997 Id Software, Inc.
  2. This program is free software; you can redistribute it and/or modify
  3. it under the terms of the GNU General Public License as published by
  4. the Free Software Foundation; either version 2 of the License, or
  5. (at your option) any later version.
  6. This program is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9. GNU General Public License for more details.
  10. You should have received a copy of the GNU General Public License
  11. along with this program; if not, write to the Free Software
  12. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  13. See file, 'COPYING', for details.
  14. */
  15. /*
  16. ==============================================================================
  17. ZOMBIE
  18. ==============================================================================
  19. */
  20. $cd /raid/quake/id1/models/zombie
  21. $origin 0 0 24
  22. $base base
  23. $skin skin
  24. $frame stand1 stand2 stand3 stand4 stand5 stand6 stand7 stand8
  25. $frame stand9 stand10 stand11 stand12 stand13 stand14 stand15
  26. $frame walk1 walk2 walk3 walk4 walk5 walk6 walk7 walk8 walk9 walk10 walk11
  27. $frame walk12 walk13 walk14 walk15 walk16 walk17 walk18 walk19
  28. $frame run1 run2 run3 run4 run5 run6 run7 run8 run9 run10 run11 run12
  29. $frame run13 run14 run15 run16 run17 run18
  30. $frame atta1 atta2 atta3 atta4 atta5 atta6 atta7 atta8 atta9 atta10 atta11
  31. $frame atta12 atta13
  32. $frame attb1 attb2 attb3 attb4 attb5 attb6 attb7 attb8 attb9 attb10 attb11
  33. $frame attb12 attb13 attb14
  34. $frame attc1 attc2 attc3 attc4 attc5 attc6 attc7 attc8 attc9 attc10 attc11
  35. $frame attc12
  36. $frame paina1 paina2 paina3 paina4 paina5 paina6 paina7 paina8 paina9 paina10
  37. $frame paina11 paina12
  38. $frame painb1 painb2 painb3 painb4 painb5 painb6 painb7 painb8 painb9 painb10
  39. $frame painb11 painb12 painb13 painb14 painb15 painb16 painb17 painb18 painb19
  40. $frame painb20 painb21 painb22 painb23 painb24 painb25 painb26 painb27 painb28
  41. $frame painc1 painc2 painc3 painc4 painc5 painc6 painc7 painc8 painc9 painc10
  42. $frame painc11 painc12 painc13 painc14 painc15 painc16 painc17 painc18
  43. $frame paind1 paind2 paind3 paind4 paind5 paind6 paind7 paind8 paind9 paind10
  44. $frame paind11 paind12 paind13
  45. $frame paine1 paine2 paine3 paine4 paine5 paine6 paine7 paine8 paine9 paine10
  46. $frame paine11 paine12 paine13 paine14 paine15 paine16 paine17 paine18 paine19
  47. $frame paine20 paine21 paine22 paine23 paine24 paine25 paine26 paine27 paine28
  48. $frame paine29 paine30
  49. $frame cruc_1 cruc_2 cruc_3 cruc_4 cruc_5 cruc_6
  50. float SPAWN_CRUCIFIED = 1;
  51. //=============================================================================
  52. .float inpain;
  53. void() zombie_stand1 =[ $stand1, zombie_stand2 ] {ai_stand();};
  54. void() zombie_stand2 =[ $stand2, zombie_stand3 ] {ai_stand();};
  55. void() zombie_stand3 =[ $stand3, zombie_stand4 ] {ai_stand();};
  56. void() zombie_stand4 =[ $stand4, zombie_stand5 ] {ai_stand();};
  57. void() zombie_stand5 =[ $stand5, zombie_stand6 ] {ai_stand();};
  58. void() zombie_stand6 =[ $stand6, zombie_stand7 ] {ai_stand();};
  59. void() zombie_stand7 =[ $stand7, zombie_stand8 ] {ai_stand();};
  60. void() zombie_stand8 =[ $stand8, zombie_stand9 ] {ai_stand();};
  61. void() zombie_stand9 =[ $stand9, zombie_stand10 ] {ai_stand();};
  62. void() zombie_stand10 =[ $stand10, zombie_stand11 ] {ai_stand();};
  63. void() zombie_stand11 =[ $stand11, zombie_stand12 ] {ai_stand();};
  64. void() zombie_stand12 =[ $stand12, zombie_stand13 ] {ai_stand();};
  65. void() zombie_stand13 =[ $stand13, zombie_stand14 ] {ai_stand();};
  66. void() zombie_stand14 =[ $stand14, zombie_stand15 ] {ai_stand();};
  67. void() zombie_stand15 =[ $stand15, zombie_stand1 ] {ai_stand();};
  68. void() zombie_cruc1 = [ $cruc_1, zombie_cruc2 ] {
  69. if (random() < 0.1)
  70. sound (self, CHAN_VOICE, "zombie/idle_w2.wav", 1, ATTN_STATIC);};
  71. void() zombie_cruc2 = [ $cruc_2, zombie_cruc3 ] {self.nextthink = time + 0.1 + random()*0.1;};
  72. void() zombie_cruc3 = [ $cruc_3, zombie_cruc4 ] {self.nextthink = time + 0.1 + random()*0.1;};
  73. void() zombie_cruc4 = [ $cruc_4, zombie_cruc5 ] {self.nextthink = time + 0.1 + random()*0.1;};
  74. void() zombie_cruc5 = [ $cruc_5, zombie_cruc6 ] {self.nextthink = time + 0.1 + random()*0.1;};
  75. void() zombie_cruc6 = [ $cruc_6, zombie_cruc1 ] {self.nextthink = time + 0.1 + random()*0.1;};
  76. void() zombie_walk1 =[ $walk1, zombie_walk2 ] {ai_walk(0);};
  77. void() zombie_walk2 =[ $walk2, zombie_walk3 ] {ai_walk(2);};
  78. void() zombie_walk3 =[ $walk3, zombie_walk4 ] {ai_walk(3);};
  79. void() zombie_walk4 =[ $walk4, zombie_walk5 ] {ai_walk(2);};
  80. void() zombie_walk5 =[ $walk5, zombie_walk6 ] {ai_walk(1);};
  81. void() zombie_walk6 =[ $walk6, zombie_walk7 ] {ai_walk(0);};
  82. void() zombie_walk7 =[ $walk7, zombie_walk8 ] {ai_walk(0);};
  83. void() zombie_walk8 =[ $walk8, zombie_walk9 ] {ai_walk(0);};
  84. void() zombie_walk9 =[ $walk9, zombie_walk10 ] {ai_walk(0);};
  85. void() zombie_walk10 =[ $walk10, zombie_walk11 ] {ai_walk(0);};
  86. void() zombie_walk11 =[ $walk11, zombie_walk12 ] {ai_walk(2);};
  87. void() zombie_walk12 =[ $walk12, zombie_walk13 ] {ai_walk(2);};
  88. void() zombie_walk13 =[ $walk13, zombie_walk14 ] {ai_walk(1);};
  89. void() zombie_walk14 =[ $walk14, zombie_walk15 ] {ai_walk(0);};
  90. void() zombie_walk15 =[ $walk15, zombie_walk16 ] {ai_walk(0);};
  91. void() zombie_walk16 =[ $walk16, zombie_walk17 ] {ai_walk(0);};
  92. void() zombie_walk17 =[ $walk17, zombie_walk18 ] {ai_walk(0);};
  93. void() zombie_walk18 =[ $walk18, zombie_walk19 ] {ai_walk(0);};
  94. void() zombie_walk19 =[ $walk19, zombie_walk1 ] {
  95. ai_walk(0);
  96. if (random() < 0.2)
  97. sound (self, CHAN_VOICE, "zombie/z_idle.wav", 1, ATTN_IDLE);};
  98. void() zombie_run1 =[ $run1, zombie_run2 ] {ai_run(1);self.inpain = 0;};
  99. void() zombie_run2 =[ $run2, zombie_run3 ] {ai_run(1);};
  100. void() zombie_run3 =[ $run3, zombie_run4 ] {ai_run(0);};
  101. void() zombie_run4 =[ $run4, zombie_run5 ] {ai_run(1);};
  102. void() zombie_run5 =[ $run5, zombie_run6 ] {ai_run(2);};
  103. void() zombie_run6 =[ $run6, zombie_run7 ] {ai_run(3);};
  104. void() zombie_run7 =[ $run7, zombie_run8 ] {ai_run(4);};
  105. void() zombie_run8 =[ $run8, zombie_run9 ] {ai_run(4);};
  106. void() zombie_run9 =[ $run9, zombie_run10 ] {ai_run(2);};
  107. void() zombie_run10 =[ $run10, zombie_run11 ] {ai_run(0);};
  108. void() zombie_run11 =[ $run11, zombie_run12 ] {ai_run(0);};
  109. void() zombie_run12 =[ $run12, zombie_run13 ] {ai_run(0);};
  110. void() zombie_run13 =[ $run13, zombie_run14 ] {ai_run(2);};
  111. void() zombie_run14 =[ $run14, zombie_run15 ] {ai_run(4);};
  112. void() zombie_run15 =[ $run15, zombie_run16 ] {ai_run(6);};
  113. void() zombie_run16 =[ $run16, zombie_run17 ] {ai_run(7);};
  114. void() zombie_run17 =[ $run17, zombie_run18 ] {ai_run(3);};
  115. void() zombie_run18 =[ $run18, zombie_run1 ] {
  116. ai_run(8);
  117. if (random() < 0.2)
  118. sound (self, CHAN_VOICE, "zombie/z_idle.wav", 1, ATTN_IDLE);
  119. if (random() > 0.8)
  120. sound (self, CHAN_VOICE, "zombie/z_idle1.wav", 1, ATTN_IDLE);
  121. };
  122. /*
  123. =============================================================================
  124. ATTACKS
  125. =============================================================================
  126. */
  127. void() ZombieGrenadeTouch =
  128. {
  129. if (other == self.owner)
  130. return; // don't explode on owner
  131. if (other.takedamage)
  132. {
  133. T_Damage (other, self, self.owner, 10 );
  134. sound (self, CHAN_WEAPON, "zombie/z_hit.wav", 1, ATTN_NORM);
  135. remove (self);
  136. return;
  137. }
  138. sound (self, CHAN_WEAPON, "zombie/z_miss.wav", 1, ATTN_NORM); // bounce sound
  139. self.velocity = '0 0 0';
  140. self.avelocity = '0 0 0';
  141. self.touch = SUB_Remove;
  142. };
  143. /*
  144. ================
  145. ZombieFireGrenade
  146. ================
  147. */
  148. void(vector st) ZombieFireGrenade =
  149. {
  150. local entity missile, mpuff;
  151. local vector org;
  152. sound (self, CHAN_WEAPON, "zombie/z_shot1.wav", 1, ATTN_NORM);
  153. missile = spawn ();
  154. missile.owner = self;
  155. missile.movetype = MOVETYPE_BOUNCE;
  156. missile.solid = SOLID_BBOX;
  157. // calc org
  158. org = self.origin + st_x * v_forward + st_y * v_right + (st_z - 24) * v_up;
  159. // set missile speed
  160. makevectors (self.angles);
  161. missile.velocity = normalize(self.enemy.origin - org);
  162. missile.velocity = missile.velocity * 600;
  163. missile.velocity_z = 200;
  164. missile.avelocity = '3000 1000 2000';
  165. missile.touch = ZombieGrenadeTouch;
  166. // set missile duration
  167. missile.nextthink = time + 2.5;
  168. missile.think = SUB_Remove;
  169. setmodel (missile, "progs/zom_gib.mdl");
  170. setsize (missile, '0 0 0', '0 0 0');
  171. setorigin (missile, org);
  172. };
  173. void() zombie_atta1 =[ $atta1, zombie_atta2 ] {ai_face();};
  174. void() zombie_atta2 =[ $atta2, zombie_atta3 ] {ai_face();};
  175. void() zombie_atta3 =[ $atta3, zombie_atta4 ] {ai_face();};
  176. void() zombie_atta4 =[ $atta4, zombie_atta5 ] {ai_face();};
  177. void() zombie_atta5 =[ $atta5, zombie_atta6 ] {ai_face();};
  178. void() zombie_atta6 =[ $atta6, zombie_atta7 ] {ai_face();};
  179. void() zombie_atta7 =[ $atta7, zombie_atta8 ] {ai_face();};
  180. void() zombie_atta8 =[ $atta8, zombie_atta9 ] {ai_face();};
  181. void() zombie_atta9 =[ $atta9, zombie_atta10 ] {ai_face();};
  182. void() zombie_atta10 =[ $atta10, zombie_atta11 ] {ai_face();};
  183. void() zombie_atta11 =[ $atta11, zombie_atta12 ] {ai_face();};
  184. void() zombie_atta12 =[ $atta12, zombie_atta13 ] {ai_face();};
  185. void() zombie_atta13 =[ $atta13, zombie_run1 ] {ai_face();ZombieFireGrenade('-10 -22 30');};
  186. void() zombie_attb1 =[ $attb1, zombie_attb2 ] {ai_face();};
  187. void() zombie_attb2 =[ $attb2, zombie_attb3 ] {ai_face();};
  188. void() zombie_attb3 =[ $attb3, zombie_attb4 ] {ai_face();};
  189. void() zombie_attb4 =[ $attb4, zombie_attb5 ] {ai_face();};
  190. void() zombie_attb5 =[ $attb5, zombie_attb6 ] {ai_face();};
  191. void() zombie_attb6 =[ $attb6, zombie_attb7 ] {ai_face();};
  192. void() zombie_attb7 =[ $attb7, zombie_attb8 ] {ai_face();};
  193. void() zombie_attb8 =[ $attb8, zombie_attb9 ] {ai_face();};
  194. void() zombie_attb9 =[ $attb9, zombie_attb10 ] {ai_face();};
  195. void() zombie_attb10 =[ $attb10, zombie_attb11 ] {ai_face();};
  196. void() zombie_attb11 =[ $attb11, zombie_attb12 ] {ai_face();};
  197. void() zombie_attb12 =[ $attb12, zombie_attb13 ] {ai_face();};
  198. void() zombie_attb13 =[ $attb13, zombie_attb14 ] {ai_face();};
  199. void() zombie_attb14 =[ $attb13, zombie_run1 ] {ai_face();ZombieFireGrenade('-10 -24 29');};
  200. void() zombie_attc1 =[ $attc1, zombie_attc2 ] {ai_face();};
  201. void() zombie_attc2 =[ $attc2, zombie_attc3 ] {ai_face();};
  202. void() zombie_attc3 =[ $attc3, zombie_attc4 ] {ai_face();};
  203. void() zombie_attc4 =[ $attc4, zombie_attc5 ] {ai_face();};
  204. void() zombie_attc5 =[ $attc5, zombie_attc6 ] {ai_face();};
  205. void() zombie_attc6 =[ $attc6, zombie_attc7 ] {ai_face();};
  206. void() zombie_attc7 =[ $attc7, zombie_attc8 ] {ai_face();};
  207. void() zombie_attc8 =[ $attc8, zombie_attc9 ] {ai_face();};
  208. void() zombie_attc9 =[ $attc9, zombie_attc10 ] {ai_face();};
  209. void() zombie_attc10 =[ $attc10, zombie_attc11 ] {ai_face();};
  210. void() zombie_attc11 =[ $attc11, zombie_attc12 ] {ai_face();};
  211. void() zombie_attc12 =[ $attc12, zombie_run1 ] {ai_face();ZombieFireGrenade('-12 -19 29');};
  212. void() zombie_missile =
  213. {
  214. local float r;
  215. r = random();
  216. if (r < 0.3)
  217. zombie_atta1 ();
  218. else if (r < 0.6)
  219. zombie_attb1 ();
  220. else
  221. zombie_attc1 ();
  222. };
  223. /*
  224. =============================================================================
  225. PAIN
  226. =============================================================================
  227. */
  228. void() zombie_paina1 =[ $paina1, zombie_paina2 ] {sound (self, CHAN_VOICE, "zombie/z_pain.wav", 1, ATTN_NORM);};
  229. void() zombie_paina2 =[ $paina2, zombie_paina3 ] {ai_painforward(3);};
  230. void() zombie_paina3 =[ $paina3, zombie_paina4 ] {ai_painforward(1);};
  231. void() zombie_paina4 =[ $paina4, zombie_paina5 ] {ai_pain(1);};
  232. void() zombie_paina5 =[ $paina5, zombie_paina6 ] {ai_pain(3);};
  233. void() zombie_paina6 =[ $paina6, zombie_paina7 ] {ai_pain(1);};
  234. void() zombie_paina7 =[ $paina7, zombie_paina8 ] {};
  235. void() zombie_paina8 =[ $paina8, zombie_paina9 ] {};
  236. void() zombie_paina9 =[ $paina9, zombie_paina10 ] {};
  237. void() zombie_paina10 =[ $paina10, zombie_paina11 ] {};
  238. void() zombie_paina11 =[ $paina11, zombie_paina12 ] {};
  239. void() zombie_paina12 =[ $paina12, zombie_run1 ] {};
  240. void() zombie_painb1 =[ $painb1, zombie_painb2 ] {sound (self, CHAN_VOICE, "zombie/z_pain1.wav", 1, ATTN_NORM);};
  241. void() zombie_painb2 =[ $painb2, zombie_painb3 ] {ai_pain(2);};
  242. void() zombie_painb3 =[ $painb3, zombie_painb4 ] {ai_pain(8);};
  243. void() zombie_painb4 =[ $painb4, zombie_painb5 ] {ai_pain(6);};
  244. void() zombie_painb5 =[ $painb5, zombie_painb6 ] {ai_pain(2);};
  245. void() zombie_painb6 =[ $painb6, zombie_painb7 ] {};
  246. void() zombie_painb7 =[ $painb7, zombie_painb8 ] {};
  247. void() zombie_painb8 =[ $painb8, zombie_painb9 ] {};
  248. void() zombie_painb9 =[ $painb9, zombie_painb10 ] {sound (self, CHAN_BODY, "zombie/z_fall.wav", 1, ATTN_NORM);};
  249. void() zombie_painb10 =[ $painb10, zombie_painb11 ] {};
  250. void() zombie_painb11 =[ $painb11, zombie_painb12 ] {};
  251. void() zombie_painb12 =[ $painb12, zombie_painb13 ] {};
  252. void() zombie_painb13 =[ $painb13, zombie_painb14 ] {};
  253. void() zombie_painb14 =[ $painb14, zombie_painb15 ] {};
  254. void() zombie_painb15 =[ $painb15, zombie_painb16 ] {};
  255. void() zombie_painb16 =[ $painb16, zombie_painb17 ] {};
  256. void() zombie_painb17 =[ $painb17, zombie_painb18 ] {};
  257. void() zombie_painb18 =[ $painb18, zombie_painb19 ] {};
  258. void() zombie_painb19 =[ $painb19, zombie_painb20 ] {};
  259. void() zombie_painb20 =[ $painb20, zombie_painb21 ] {};
  260. void() zombie_painb21 =[ $painb21, zombie_painb22 ] {};
  261. void() zombie_painb22 =[ $painb22, zombie_painb23 ] {};
  262. void() zombie_painb23 =[ $painb23, zombie_painb24 ] {};
  263. void() zombie_painb24 =[ $painb24, zombie_painb25 ] {};
  264. void() zombie_painb25 =[ $painb25, zombie_painb26 ] {ai_painforward(1);};
  265. void() zombie_painb26 =[ $painb26, zombie_painb27 ] {};
  266. void() zombie_painb27 =[ $painb27, zombie_painb28 ] {};
  267. void() zombie_painb28 =[ $painb28, zombie_run1 ] {};
  268. void() zombie_painc1 =[ $painc1, zombie_painc2 ] {sound (self, CHAN_VOICE, "zombie/z_pain1.wav", 1, ATTN_NORM);};
  269. void() zombie_painc2 =[ $painc2, zombie_painc3 ] {};
  270. void() zombie_painc3 =[ $painc3, zombie_painc4 ] {ai_pain(3);};
  271. void() zombie_painc4 =[ $painc4, zombie_painc5 ] {ai_pain(1);};
  272. void() zombie_painc5 =[ $painc5, zombie_painc6 ] {};
  273. void() zombie_painc6 =[ $painc6, zombie_painc7 ] {};
  274. void() zombie_painc7 =[ $painc7, zombie_painc8 ] {};
  275. void() zombie_painc8 =[ $painc8, zombie_painc9 ] {};
  276. void() zombie_painc9 =[ $painc9, zombie_painc10 ] {};
  277. void() zombie_painc10 =[ $painc10, zombie_painc11 ] {};
  278. void() zombie_painc11 =[ $painc11, zombie_painc12 ] {ai_painforward(1);};
  279. void() zombie_painc12 =[ $painc12, zombie_painc13 ] {ai_painforward(1);};
  280. void() zombie_painc13 =[ $painc13, zombie_painc14 ] {};
  281. void() zombie_painc14 =[ $painc14, zombie_painc15 ] {};
  282. void() zombie_painc15 =[ $painc15, zombie_painc16 ] {};
  283. void() zombie_painc16 =[ $painc16, zombie_painc17 ] {};
  284. void() zombie_painc17 =[ $painc17, zombie_painc18 ] {};
  285. void() zombie_painc18 =[ $painc18, zombie_run1 ] {};
  286. void() zombie_paind1 =[ $paind1, zombie_paind2 ] {sound (self, CHAN_VOICE, "zombie/z_pain.wav", 1, ATTN_NORM);};
  287. void() zombie_paind2 =[ $paind2, zombie_paind3 ] {};
  288. void() zombie_paind3 =[ $paind3, zombie_paind4 ] {};
  289. void() zombie_paind4 =[ $paind4, zombie_paind5 ] {};
  290. void() zombie_paind5 =[ $paind5, zombie_paind6 ] {};
  291. void() zombie_paind6 =[ $paind6, zombie_paind7 ] {};
  292. void() zombie_paind7 =[ $paind7, zombie_paind8 ] {};
  293. void() zombie_paind8 =[ $paind8, zombie_paind9 ] {};
  294. void() zombie_paind9 =[ $paind9, zombie_paind10 ] {ai_pain(1);};
  295. void() zombie_paind10 =[ $paind10, zombie_paind11 ] {};
  296. void() zombie_paind11 =[ $paind11, zombie_paind12 ] {};
  297. void() zombie_paind12 =[ $paind12, zombie_paind13 ] {};
  298. void() zombie_paind13 =[ $paind13, zombie_run1 ] {};
  299. void() zombie_paine1 =[ $paine1, zombie_paine2 ] {
  300. sound (self, CHAN_VOICE, "zombie/z_pain.wav", 1, ATTN_NORM);
  301. self.health = 60;
  302. };
  303. void() zombie_paine2 =[ $paine2, zombie_paine3 ] {ai_pain(8);};
  304. void() zombie_paine3 =[ $paine3, zombie_paine4 ] {ai_pain(5);};
  305. void() zombie_paine4 =[ $paine4, zombie_paine5 ] {ai_pain(3);};
  306. void() zombie_paine5 =[ $paine5, zombie_paine6 ] {ai_pain(1);};
  307. void() zombie_paine6 =[ $paine6, zombie_paine7 ] {ai_pain(2);};
  308. void() zombie_paine7 =[ $paine7, zombie_paine8 ] {ai_pain(1);};
  309. void() zombie_paine8 =[ $paine8, zombie_paine9 ] {ai_pain(1);};
  310. void() zombie_paine9 =[ $paine9, zombie_paine10 ] {ai_pain(2);};
  311. void() zombie_paine10 =[ $paine10, zombie_paine11 ] {
  312. sound (self, CHAN_BODY, "zombie/z_fall.wav", 1, ATTN_NORM);
  313. self.solid = SOLID_NOT;
  314. };
  315. void() zombie_paine11 =[ $paine11, zombie_paine12 ] {self.nextthink = self.nextthink + 5;self.health = 60;};
  316. void() zombie_paine12 =[ $paine12, zombie_paine13 ]{
  317. // see if ok to stand up
  318. self.health = 60;
  319. sound (self, CHAN_VOICE, "zombie/z_idle.wav", 1, ATTN_IDLE);
  320. self.solid = SOLID_SLIDEBOX;
  321. if (!walkmove (0, 0))
  322. {
  323. self.think = zombie_paine11;
  324. self.solid = SOLID_NOT;
  325. return;
  326. }
  327. };
  328. void() zombie_paine13 =[ $paine13, zombie_paine14 ] {};
  329. void() zombie_paine14 =[ $paine14, zombie_paine15 ] {};
  330. void() zombie_paine15 =[ $paine15, zombie_paine16 ] {};
  331. void() zombie_paine16 =[ $paine16, zombie_paine17 ] {};
  332. void() zombie_paine17 =[ $paine17, zombie_paine18 ] {};
  333. void() zombie_paine18 =[ $paine18, zombie_paine19 ] {};
  334. void() zombie_paine19 =[ $paine19, zombie_paine20 ] {};
  335. void() zombie_paine20 =[ $paine20, zombie_paine21 ] {};
  336. void() zombie_paine21 =[ $paine21, zombie_paine22 ] {};
  337. void() zombie_paine22 =[ $paine22, zombie_paine23 ] {};
  338. void() zombie_paine23 =[ $paine23, zombie_paine24 ] {};
  339. void() zombie_paine24 =[ $paine24, zombie_paine25 ] {};
  340. void() zombie_paine25 =[ $paine25, zombie_paine26 ] {ai_painforward(5);};
  341. void() zombie_paine26 =[ $paine26, zombie_paine27 ] {ai_painforward(3);};
  342. void() zombie_paine27 =[ $paine27, zombie_paine28 ] {ai_painforward(1);};
  343. void() zombie_paine28 =[ $paine28, zombie_paine29 ] {ai_pain(1);};
  344. void() zombie_paine29 =[ $paine29, zombie_paine30 ] {};
  345. void() zombie_paine30 =[ $paine30, zombie_run1 ] {};
  346. void() zombie_die =
  347. {
  348. sound (self, CHAN_VOICE, "zombie/z_gib.wav", 1, ATTN_NORM);
  349. ThrowHead ("progs/h_zombie.mdl", self.health);
  350. ThrowGib ("progs/gib1.mdl", self.health);
  351. ThrowGib ("progs/gib2.mdl", self.health);
  352. ThrowGib ("progs/gib3.mdl", self.health);
  353. };
  354. /*
  355. =================
  356. zombie_pain
  357. Zombies can only be killed (gibbed) by doing 60 hit points of damage
  358. in a single frame (rockets, grenades, quad shotgun, quad nailgun).
  359. A hit of 25 points or more (super shotgun, quad nailgun) will allways put it
  360. down to the ground.
  361. A hit of from 10 to 40 points in one frame will cause it to go down if it
  362. has been twice in two seconds, otherwise it goes into one of the four
  363. fast pain frames.
  364. A hit of less than 10 points of damage (winged by a shotgun) will be ignored.
  365. FIXME: don't use pain_finished because of nightmare hack
  366. =================
  367. */
  368. void(entity attacker, float take) zombie_pain =
  369. {
  370. local float r;
  371. self.health = 60; // allways reset health
  372. if (take < 9)
  373. return; // totally ignore
  374. if (self.inpain == 2)
  375. return; // down on ground, so don't reset any counters
  376. // go down immediately if a big enough hit
  377. if (take >= 25)
  378. {
  379. self.inpain = 2;
  380. zombie_paine1 ();
  381. return;
  382. }
  383. if (self.inpain)
  384. {
  385. // if hit again in next gre seconds while not in pain frames, definately drop
  386. self.pain_finished = time + 3;
  387. return; // currently going through an animation, don't change
  388. }
  389. if (self.pain_finished > time)
  390. {
  391. // hit again, so drop down
  392. self.inpain = 2;
  393. zombie_paine1 ();
  394. return;
  395. }
  396. // gp into one of the fast pain animations
  397. self.inpain = 1;
  398. r = random();
  399. if (r < 0.25)
  400. zombie_paina1 ();
  401. else if (r < 0.5)
  402. zombie_painb1 ();
  403. else if (r < 0.75)
  404. zombie_painc1 ();
  405. else
  406. zombie_paind1 ();
  407. };
  408. //============================================================================
  409. /*QUAKED monster_zombie (1 0 0) (-16 -16 -24) (16 16 32) Crucified ambush
  410. If crucified, stick the bounding box 12 pixels back into a wall to look right.
  411. */
  412. void() monster_zombie =
  413. {
  414. if (deathmatch)
  415. {
  416. remove(self);
  417. return;
  418. }
  419. precache_model ("progs/zombie.mdl");
  420. precache_model ("progs/h_zombie.mdl");
  421. precache_model ("progs/zom_gib.mdl");
  422. precache_sound ("zombie/z_idle.wav");
  423. precache_sound ("zombie/z_idle1.wav");
  424. precache_sound ("zombie/z_shot1.wav");
  425. precache_sound ("zombie/z_gib.wav");
  426. precache_sound ("zombie/z_pain.wav");
  427. precache_sound ("zombie/z_pain1.wav");
  428. precache_sound ("zombie/z_fall.wav");
  429. precache_sound ("zombie/z_miss.wav");
  430. precache_sound ("zombie/z_hit.wav");
  431. precache_sound ("zombie/idle_w2.wav");
  432. self.solid = SOLID_SLIDEBOX;
  433. self.movetype = MOVETYPE_STEP;
  434. setmodel (self, "progs/zombie.mdl");
  435. setsize (self, '-16 -16 -24', '16 16 40');
  436. self.health = 60;
  437. self.th_stand = zombie_stand1;
  438. self.th_walk = zombie_walk1;
  439. self.th_run = zombie_run1;
  440. self.th_pain = zombie_pain;
  441. self.th_die = zombie_die;
  442. self.th_missile = zombie_missile;
  443. if (self.spawnflags & SPAWN_CRUCIFIED)
  444. {
  445. self.movetype = MOVETYPE_NONE;
  446. zombie_cruc1 ();
  447. }
  448. else
  449. walkmonster_start();
  450. };