home *** CD-ROM | disk | FTP | other *** search
/ Superpower (Alt) / SUPERPOWER.iso / q / patch / mbq759 / player.qc < prev    next >
Encoding:
Text File  |  1996-08-22  |  26.6 KB  |  846 lines

  1. void() W_FireChain;
  2. void() W_ThrowAxe;
  3. void() MakeSolidHead;
  4. void() bubble_bob;
  5. void() feign;
  6. void(entity me) hologram_explode;
  7. /*
  8. ==============================================================================
  9.  
  10. PLAYER
  11.  
  12. ==============================================================================
  13. */
  14.  
  15. $cd /raid/quake/id1/models/player_4
  16. $origin 0 -6 24
  17. $base base        
  18. $skin skin
  19.  
  20. //
  21. // running
  22. //
  23. $frame axrun1 axrun2 axrun3 axrun4 axrun5 axrun6
  24.  
  25. $frame rockrun1 rockrun2 rockrun3 rockrun4 rockrun5 rockrun6
  26.  
  27. //
  28. // standing
  29. //
  30. $frame stand1 stand2 stand3 stand4 stand5
  31.  
  32. $frame axstnd1 axstnd2 axstnd3 axstnd4 axstnd5 axstnd6
  33. $frame axstnd7 axstnd8 axstnd9 axstnd10 axstnd11 axstnd12
  34.  
  35.  
  36. //
  37. // pain
  38. //
  39. $frame axpain1 axpain2 axpain3 axpain4 axpain5 axpain6
  40.  
  41. $frame pain1 pain2 pain3 pain4 pain5 pain6
  42.  
  43.  
  44. //
  45. // death
  46. //
  47.  
  48. $frame axdeth1 axdeth2 axdeth3 axdeth4 axdeth5 axdeth6
  49. $frame axdeth7 axdeth8 axdeth9
  50.  
  51. $frame deatha1 deatha2 deatha3 deatha4 deatha5 deatha6 deatha7 deatha8
  52. $frame deatha9 deatha10 deatha11
  53.  
  54. $frame deathb1 deathb2 deathb3 deathb4 deathb5 deathb6 deathb7 deathb8
  55. $frame deathb9
  56.  
  57. $frame deathc1 deathc2 deathc3 deathc4 deathc5 deathc6 deathc7 deathc8
  58. $frame deathc9 deathc10 deathc11 deathc12 deathc13 deathc14 deathc15
  59.  
  60. $frame deathd1 deathd2 deathd3 deathd4 deathd5 deathd6 deathd7
  61. $frame deathd8 deathd9
  62.  
  63. $frame deathe1 deathe2 deathe3 deathe4 deathe5 deathe6 deathe7
  64. $frame deathe8 deathe9
  65.  
  66. //
  67. // attacks
  68. //
  69. $frame nailatt1 nailatt2
  70.  
  71. $frame light1 light2
  72.  
  73. $frame rockatt1 rockatt2 rockatt3 rockatt4 rockatt5 rockatt6
  74.  
  75. $frame shotatt1 shotatt2 shotatt3 shotatt4 shotatt5 shotatt6
  76.  
  77. $frame axatt1 axatt2 axatt3 axatt4 axatt5 axatt6
  78.  
  79. $frame axattb1 axattb2 axattb3 axattb4 axattb5 axattb6
  80.  
  81. $frame axattc1 axattc2 axattc3 axattc4 axattc5 axattc6
  82.  
  83. $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
  84.  
  85.  
  86. /*
  87. ==============================================================================
  88. PLAYER
  89. ==============================================================================
  90. */
  91.  
  92. void() player_run;
  93.  
  94. void()    player_stand1 =[    $axstnd1,    player_stand1    ]
  95. {
  96.     self.weaponframe=0;
  97.     if (self.velocity_x || self.velocity_y)
  98.     {
  99.         self.walkframe=0;
  100.         player_run();
  101.         return;
  102.     }
  103.  
  104.     if (self.weapon == IT_AXE || self.weapon == IT_THROWING_AXE)
  105.     {
  106.         if (self.walkframe >= 12)
  107.             self.walkframe = 0;
  108.         self.frame = $axstnd1 + self.walkframe;
  109.     }
  110.     else
  111.     {
  112.         if (self.walkframe >= 5)
  113.             self.walkframe = 0;
  114.         self.frame = $stand1 + self.walkframe;
  115.     }
  116.     self.walkframe = self.walkframe + 1;    
  117. };
  118.  
  119. void()    player_run =[    $rockrun1,    player_run    ]
  120. {
  121.     self.weaponframe=0;
  122.     if (!self.velocity_x && !self.velocity_y)
  123.     {
  124.         self.walkframe=0;
  125.         player_stand1();
  126.         return;
  127.     }
  128.  
  129.     if (self.weapon == IT_AXE || self.weapon == IT_THROWING_AXE)
  130.     {
  131.         if (self.walkframe == 6)
  132.             self.walkframe = 0;
  133.         self.frame = $axrun1 + self.walkframe;
  134.     }
  135.     else
  136.     {
  137.         if (self.walkframe == 6)
  138.             self.walkframe = 0;
  139.         self.frame = self.frame + self.walkframe;
  140.     }
  141.         if (self.walkframe == 1 || self.walkframe == 4 )
  142.         {
  143.                 if (checkbottom(self) == TRUE)
  144.                 {
  145.                         if (self.waterlevel == 0)
  146.                                 sound (self, CHAN_AUTO, "player/step.wav", 1, ATTN_NORM);
  147.                 }
  148.         }
  149.     self.walkframe = self.walkframe + 1;
  150. };
  151.  
  152.  
  153. void()    player_shot1 =    [$shotatt1, player_shot2    ] {self.weaponframe=1;
  154. self.effects = self.effects | EF_MUZZLEFLASH;};
  155. void()    player_shot2 =    [$shotatt2, player_shot3    ] {self.weaponframe=2;};
  156. void()    player_shot3 =    [$shotatt3, player_shot4    ] {self.weaponframe=3;};
  157. void()    player_shot4 =    [$shotatt4, player_shot5    ] {self.weaponframe=4;};
  158. void()    player_shot5 =    [$shotatt5, player_shot6    ] {self.weaponframe=5;};
  159. void()    player_shot6 =    [$shotatt6, player_run    ] {self.weaponframe=6;};
  160.  
  161. void()  player_tax1 =   [$axatt1, player_tax2   ] {self.weaponframe=1;};
  162. void()  player_tax2 =   [$axatt2, player_tax3   ] {self.weaponframe=2;};
  163. void()  player_tax3 =   [$axatt3, player_tax4   ] {self.weaponframe=3;W_ThrowAxe();};
  164. void()  player_tax4 =   [$axatt4, player_run    ] {self.weaponframe=4;};
  165.  
  166. void()    player_axe1 =    [$axatt1, player_axe2    ] {self.weaponframe=1;};
  167. void()    player_axe2 =    [$axatt2, player_axe3    ] {self.weaponframe=2;};
  168. void()    player_axe3 =    [$axatt3, player_axe4    ] {self.weaponframe=3;W_FireAxe();};
  169. void()    player_axe4 =    [$axatt4, player_run    ] {self.weaponframe=4;};
  170.  
  171. void()    player_axeb1 =    [$axattb1, player_axeb2    ] {self.weaponframe=5;};
  172. void()    player_axeb2 =    [$axattb2, player_axeb3    ] {self.weaponframe=6;};
  173. void()    player_axeb3 =    [$axattb3, player_axeb4    ] {self.weaponframe=7;W_FireAxe();};
  174. void()    player_axeb4 =    [$axattb4, player_run    ] {self.weaponframe=8;};
  175.  
  176. void()    player_axec1 =    [$axattc1, player_axec2    ] {self.weaponframe=1;};
  177. void()    player_axec2 =    [$axattc2, player_axec3    ] {self.weaponframe=2;};
  178. void()    player_axec3 =    [$axattc3, player_axec4    ] {self.weaponframe=3;W_FireAxe();};
  179. void()    player_axec4 =    [$axattc4, player_run    ] {self.weaponframe=4;};
  180.  
  181. void()    player_axed1 =    [$axattd1, player_axed2    ] {self.weaponframe=5;};
  182. void()    player_axed2 =    [$axattd2, player_axed3    ] {self.weaponframe=6;};
  183. void()    player_axed3 =    [$axattd3, player_axed4    ] {self.weaponframe=7;W_FireAxe();};
  184. void()    player_axed4 =    [$axattd4, player_run    ] {self.weaponframe=8;};
  185.  
  186. void()  player_chain5=  [$axattd4, player_run    ] {self.weaponframe=5;};
  187. void()  player_chain4=  [$deathc4, player_chain4 ]
  188. {
  189.         self.weaponframe=4;
  190.         if (!self.hook_out)
  191.         {
  192.                 player_chain5();
  193.                 return;
  194.         }
  195.         if (vlen(self.velocity) < 750)
  196.         {
  197.                 player_chain3();
  198.                 return;
  199.         }
  200. };
  201. void()  player_chain3=  [$axattd3, player_chain3 ]
  202. {
  203.         self.weaponframe=3;
  204.         if (!self.hook_out)
  205.         {
  206.                 player_chain5();
  207.                 return;
  208.         }
  209.         if (vlen(self.velocity) >= 750)
  210.         {
  211.                 player_chain4();
  212.                 return;
  213.         }
  214. };
  215. void()  player_chain2=  [$axattd2, player_chain3 ] {self.weaponframe=3;W_FireChain();};
  216. void()  player_chain1=  [$axattd1, player_chain2 ] {self.weaponframe=2;};
  217.  
  218. void()  player_feigna1    =       [       $deatha1,       player_feigna2    ] {};
  219. void()  player_feigna2    =       [       $deatha2,       player_feigna3    ] {};
  220. void()  player_feigna3    =       [       $deatha3,       player_feigna4    ] {};
  221. void()  player_feigna4    =       [       $deatha4,       player_feigna5    ] {};
  222. void()  player_feigna5    =       [       $deatha5,       player_feigna6    ] {};
  223. void()  player_feigna6    =       [       $deatha6,       player_feigna7    ] {};
  224. void()  player_feigna7    =       [       $deatha7,       player_feigna8    ] {};
  225. void()  player_feigna8    =       [       $deatha8,       player_feigna9    ] {};
  226. void()  player_feigna9    =       [       $deatha9,       player_feigna10   ] {};
  227. void()  player_feigna10   =       [       $deatha10,      player_feigna11   ] {};
  228. void()  player_feigna11   =       [       $deatha11,      player_feigna11   ] {};
  229.  
  230. void() player_upa1 = [$deathd9, player_upa2] {self.view_ofs = '0 0 4';};
  231. void() player_upa2 = [$deathd8, player_upa3] {self.view_ofs = '0 0 6';};
  232. void() player_upa3 = [$deathd7, player_upa4] {self.view_ofs = '0 0 8';};
  233. void() player_upa4 = [$deathd6, player_upa5] {self.view_ofs = '0 0 10';};
  234. void() player_upa5 = [$deathd5, player_upa6] {self.view_ofs = '0 0 12';};
  235. void() player_upa6 = [$deathd4, player_upa7] {self.view_ofs = '0 0 14';};
  236. void() player_upa7 = [$deathd3, player_upa8] {self.view_ofs = '0 0 16';};
  237. void() player_upa8 = [$deathd2, player_upa9] {self.view_ofs = '0 0 18';};
  238. void() player_upa9 = [$deathd1, player_upa9] {player_stand1 ();};
  239.  
  240. void() player_upax1 = [$axdeth9, player_upax2] {self.view_ofs = '0 0 4';};
  241. void() player_upax2 = [$axdeth8, player_upax3] {self.view_ofs = '0 0 6';};
  242. void() player_upax3 = [$axdeth7, player_upax4] {self.view_ofs = '0 0 8';};
  243. void() player_upax4 = [$axdeth6, player_upax5] {self.view_ofs = '0 0 10';};
  244. void() player_upax5 = [$axdeth5, player_upax6] {self.view_ofs = '0 0 12';};
  245. void() player_upax6 = [$axdeth4, player_upax7] {self.view_ofs = '0 0 14';};
  246. void() player_upax7 = [$axdeth3, player_upax8] {self.view_ofs = '0 0 16';};
  247. void() player_upax8 = [$axdeth2, player_upax9] {self.view_ofs = '0 0 18';};
  248. void() player_upax9 = [$axdeth1, player_upax9] {player_stand1 ();};
  249.  
  250. void() player_up =
  251. {
  252.         self.flags = self.flags - (self.flags & FL_ISFEIGN);
  253.         self.movetype = MOVETYPE_WALK;
  254.         self.weaponmodel = self.oldweaponmodel;
  255.         self.weapon = self.oldweapon;
  256.         self.oldweapon = 0;
  257.         if (self.weapon == IT_AXE || self.weapon == IT_THROWING_AXE || self.weapon == IT_MORNINGSTAR)
  258.                 player_upax1 ();
  259.     else
  260.                 player_upa1 ();
  261.         setsize (self, VEC_HULL_MIN, VEC_HULL_MAX);
  262.         self.view_ofs = '0 0 22';
  263. };
  264.  
  265. void() player_axfall1 = [$axdeth1, player_axfall2] {self.view_ofs = '0 0 21';};
  266. void() player_axfall2 = [$axdeth2, player_axfall3] {self.view_ofs = '0 0 18';};
  267. void() player_axfall3 = [$axdeth3, player_axfall4] {self.view_ofs = '0 0 15';};
  268. void() player_axfall4 = [$axdeth4, player_axfall5] {self.view_ofs = '0 0 13';};
  269. void() player_axfall5 = [$axdeth5, player_axfall6] {self.view_ofs = '0 0 11';};
  270. void() player_axfall6 = [$axdeth6, player_axfall7] {self.view_ofs = '0 0 8';};
  271. void() player_axfall7 = [$axdeth7, player_axfall8] {self.view_ofs = '0 0 5';};
  272. void() player_axfall8 = [$axdeth8, player_axfall9] {self.view_ofs = '0 0 2';};
  273. void() player_axfall9 = [$axdeth9, player_axfall9]
  274. {
  275.         self.nextthink = time + 0.3;
  276.         self.think = player_up;
  277. };
  278.  
  279. void()  player_fall1 =  [$deathc1,  player_fall2]  {self.view_ofs = '0 0 20.7';};
  280. void()  player_fall2 =  [$deathc2,  player_fall3]  {self.view_ofs = '0 0 19.4';};
  281. void()  player_fall3 =  [$deathc3,  player_fall4]  {self.view_ofs = '0 0 18.1';};
  282. void()  player_fall4 =  [$deathc4,  player_fall5]  {self.view_ofs = '0 0 16.8';};
  283. void()  player_fall5 =  [$deathc5,  player_fall6]  {self.view_ofs = '0 0 15.5';};
  284. void()  player_fall6 =  [$deathc6,  player_fall7]  {self.view_ofs = '0 0 14.2';};
  285. void()  player_fall7 =  [$deathc7,  player_fall8]  {self.view_ofs = '0 0 12.9';};
  286. void()  player_fall8 =  [$deathc8,  player_fall9]  {self.view_ofs = '0 0 11.6';};
  287. void()  player_fall9 =  [$deathc9,  player_fall10] {self.view_ofs = '0 0 10.3';};
  288. void()  player_fall10 = [$deathc10, player_fall11] {self.view_ofs = '0 0 9';};
  289. void()  player_fall11 = [$deathc11, player_fall12]  {self.view_ofs = '0 0 7.7';};
  290. void()  player_fall12 =  [$deathc12,  player_fall13]  {self.view_ofs = '0 0 6.4';};
  291. void()  player_fall13 =  [$deathc13,  player_fall14]  {self.view_ofs = '0 0 5.1';};
  292. void()  player_fall14 =  [$deathc14,  player_fall15]  {self.view_ofs = '0 0 2.8';};
  293. void()  player_fall15 =  [$deathc15,  player_fall15]
  294. {
  295.         self.nextthink = time + 0.3;
  296.         self.think = player_up;
  297. };
  298.  
  299. void() player_fall =
  300. {
  301.         if (self.weaponframe)
  302.                 return;
  303.  
  304.         if (self.invisible_finished > time)
  305.                 return;         // eyes don't have pain frames
  306.  
  307.         if (self.flags & FL_ISFEIGN)       // experimental
  308.                 return;
  309.  
  310.         self.flags = self.flags | FL_ISFEIGN;
  311.         self.oldweapon = self.weapon;   
  312.         self.weapon = 0;
  313.         self.oldweaponmodel = self.weaponmodel;
  314.         self.weaponmodel = "";
  315.         self.movetype = MOVETYPE_TOSS;
  316.         if (self.oldweapon == IT_AXE || self.oldweapon == IT_THROWING_AXE || self.weapon == IT_MORNINGSTAR)
  317.         player_axfall1 ();
  318.     else
  319.         player_fall1 ();
  320.         setsize (self , '-16 -16 -4' , '16 16 4');
  321.         self.view_ofs = '0 0 2';
  322. };
  323.  
  324. void() player_nail1   =[$nailatt1, player_nail2  ] 
  325. {
  326.     self.effects = self.effects | EF_MUZZLEFLASH;
  327.  
  328.     if (!self.button0)
  329.         {player_run ();return;}
  330.     self.weaponframe = self.weaponframe + 1;
  331.     if (self.weaponframe == 9)
  332.         self.weaponframe = 1;
  333.     SuperDamageSound();
  334.     W_FireSpikes (4);
  335.     self.attack_finished = time + 0.2;
  336. };
  337. void() player_nail2   =[$nailatt2, player_nail1  ]
  338. {
  339.     self.effects = self.effects | EF_MUZZLEFLASH;
  340.  
  341.     if (!self.button0)
  342.         {player_run ();return;}
  343.     self.weaponframe = self.weaponframe + 1;
  344.     if (self.weaponframe == 9)
  345.         self.weaponframe = 1;
  346.     SuperDamageSound();
  347.     W_FireSpikes (-4);
  348.     self.attack_finished = time + 0.2;
  349. };
  350.  
  351. //============================================================================
  352.  
  353. void() player_light1   =[$light1, player_light2  ] 
  354. {
  355.     self.effects = self.effects | EF_MUZZLEFLASH;
  356.  
  357.     if (!self.button0)
  358.         {player_run ();return;}
  359.     self.weaponframe = self.weaponframe + 1;
  360.     if (self.weaponframe == 5)
  361.         self.weaponframe = 1;
  362.     SuperDamageSound();
  363.     W_FireLightning();
  364.     self.attack_finished = time + 0.2;
  365. };
  366. void() player_light2   =[$light2, player_light1  ]
  367. {
  368.     self.effects = self.effects | EF_MUZZLEFLASH;
  369.  
  370.     if (!self.button0)
  371.         {player_run ();return;}
  372.     self.weaponframe = self.weaponframe + 1;
  373.     if (self.weaponframe == 5)
  374.         self.weaponframe = 1;
  375.     SuperDamageSound();
  376.     W_FireLightning();
  377.     self.attack_finished = time + 0.2;
  378. };
  379.  
  380. //============================================================================
  381.  
  382.  
  383. void() player_rocket1   =[$rockatt1, player_rocket2  ] {self.weaponframe=1;
  384. self.effects = self.effects | EF_MUZZLEFLASH;};
  385. void() player_rocket2   =[$rockatt2, player_rocket3  ] {self.weaponframe=2;};
  386. void() player_rocket3   =[$rockatt3, player_rocket4  ] {self.weaponframe=3;};
  387. void() player_rocket4   =[$rockatt4, player_rocket5  ] {self.weaponframe=4;};
  388. void() player_rocket5   =[$rockatt5, player_rocket6  ] {self.weaponframe=5;};
  389. void() player_rocket6   =[$rockatt6, player_run  ] {self.weaponframe=6;};
  390. void(float num_bubbles) DeathBubbles;
  391.  
  392. void() PainSound =
  393. {
  394. local float        rs;
  395. local float             which_hit;
  396.     if (self.health < 0)
  397.         return;
  398.  
  399.     if (damage_attacker.classname == "teledeath")
  400.     {
  401.         sound (self, CHAN_VOICE, "player/teledth1.wav", 1, ATTN_NONE);
  402.         return;
  403.     }
  404.  
  405. // water pain sounds
  406.     if (self.watertype == CONTENT_WATER && self.waterlevel == 3)
  407.     {
  408.         DeathBubbles(1);
  409.         if (random() > 0.5)
  410.             sound (self, CHAN_VOICE, "player/drown1.wav", 1, ATTN_NORM);
  411.         else
  412.             sound (self, CHAN_VOICE, "player/drown2.wav", 1, ATTN_NORM);
  413.         return;
  414.     }
  415.  
  416. // slime pain sounds
  417.     if (self.watertype == CONTENT_SLIME)
  418.     {
  419. // FIX ME    put in some steam here
  420.         if (random() > 0.5)
  421.             sound (self, CHAN_VOICE, "player/lburn1.wav", 1, ATTN_NORM);
  422.         else
  423.             sound (self, CHAN_VOICE, "player/lburn2.wav", 1, ATTN_NORM);
  424.         return;
  425.     }
  426.  
  427.     if (self.watertype == CONTENT_LAVA)
  428.     {
  429.         if (random() > 0.5)
  430.             sound (self, CHAN_VOICE, "player/lburn1.wav", 1, ATTN_NORM);
  431.         else
  432.             sound (self, CHAN_VOICE, "player/lburn2.wav", 1, ATTN_NORM);
  433.         return;
  434.     }
  435.  
  436.     if (self.pain_finished > time)
  437.     {
  438.         self.axhitme = 0;
  439.         return;
  440.     }
  441.     self.pain_finished = time + 0.5;
  442.  
  443. // don't make multiple pain sounds right after each other
  444.  
  445. // ax pain sound
  446.     if (self.axhitme == 1)
  447.     {
  448.         self.axhitme = 0;
  449.                 which_hit = random();
  450.                 if (which_hit < 0.33)
  451.                         sound (self, CHAN_VOICE, "weapons/taxhit1.wav", 1, ATTN_NORM);
  452.                 else if (which_hit < 0.66)
  453.                         sound (self, CHAN_VOICE, "weapons/taxhit2.wav", 1, ATTN_NORM);
  454.                 else
  455.                         sound (self, CHAN_VOICE, "weapons/taxhit3.wav", 1, ATTN_NORM);
  456.         return;
  457.     }
  458.     
  459.  
  460.     rs = rint((random() * 5) + 1);
  461.  
  462.     self.noise = "";
  463.     if (rs == 1)
  464.         self.noise = "player/pain1.wav";
  465.     else if (rs == 2)
  466.         self.noise = "player/pain2.wav";
  467.     else if (rs == 3)
  468.         self.noise = "player/pain3.wav";
  469.     else if (rs == 4)
  470.         self.noise = "player/pain4.wav";
  471.     else if (rs == 5)
  472.         self.noise = "player/pain5.wav";
  473.     else
  474.         self.noise = "player/pain6.wav";
  475.  
  476.     sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
  477.     return;
  478. };
  479.  
  480. void()    player_pain1 =    [    $pain1,    player_pain2    ] {PainSound();self.weaponframe=0;};
  481. void()    player_pain2 =    [    $pain2,    player_pain3    ] {};
  482. void()    player_pain3 =    [    $pain3,    player_pain4    ] {};
  483. void()    player_pain4 =    [    $pain4,    player_pain5    ] {};
  484. void()    player_pain5 =    [    $pain5,    player_pain6    ] {};
  485. void()    player_pain6 =    [    $pain6,    player_run    ] {};
  486.  
  487. void()    player_axpain1 =    [    $axpain1,    player_axpain2    ] {PainSound();self.weaponframe=0;};
  488. void()    player_axpain2 =    [    $axpain2,    player_axpain3    ] {};
  489. void()    player_axpain3 =    [    $axpain3,    player_axpain4    ] {};
  490. void()    player_axpain4 =    [    $axpain4,    player_axpain5    ] {};
  491. void()    player_axpain5 =    [    $axpain5,    player_axpain6    ] {};
  492. void()    player_axpain6 =    [    $axpain6,    player_run    ] {};
  493.  
  494. void() player_pain =
  495. {
  496.     if (self.weaponframe)
  497.         return;
  498.  
  499.     if (self.invisible_finished > time)
  500.         return;        // eyes don't have pain frames
  501.  
  502.         if (self.flags & FL_ISFEIGN)       // experimental
  503.                 return;
  504.  
  505.         if (self.weapon == IT_AXE || self.weapon == IT_THROWING_AXE || self.weapon == IT_MORNINGSTAR)
  506.         player_axpain1 ();
  507.     else
  508.         player_pain1 ();
  509. };
  510.  
  511. void() player_diea1;
  512. void() player_dieb1;
  513. void() player_diec1;
  514. void() player_died1;
  515. void() player_diee1;
  516. void() player_die_ax1;
  517.  
  518. void() DeathBubblesSpawn =
  519. {
  520. local entity    bubble;
  521.     if (self.owner.waterlevel != 3)
  522.         return;
  523.     bubble = spawn();
  524.     setmodel (bubble, "progs/s_bubble.spr");
  525.     setorigin (bubble, self.owner.origin + '0 0 24');
  526.     bubble.movetype = MOVETYPE_NOCLIP;
  527.     bubble.solid = SOLID_NOT;
  528.     bubble.velocity = '0 0 15';
  529.     bubble.nextthink = time + 0.5;
  530.     bubble.think = bubble_bob;
  531.     bubble.classname = "bubble";
  532.     bubble.frame = 0;
  533.     bubble.cnt = 0;
  534.     setsize (bubble, '-8 -8 -8', '8 8 8');
  535.     self.nextthink = time + 0.1;
  536.     self.think = DeathBubblesSpawn;
  537.     self.air_finished = self.air_finished + 1;
  538.     if (self.air_finished >= self.bubble_count)
  539.         remove(self);
  540. };
  541.  
  542. void(float num_bubbles) DeathBubbles =
  543. {
  544. local entity    bubble_spawner;
  545.     
  546.     bubble_spawner = spawn();
  547.     setorigin (bubble_spawner, self.origin);
  548.     bubble_spawner.movetype = MOVETYPE_NONE;
  549.     bubble_spawner.solid = SOLID_NOT;
  550.     bubble_spawner.nextthink = time + 0.1;
  551.     bubble_spawner.think = DeathBubblesSpawn;
  552.     bubble_spawner.air_finished = 0;
  553.     bubble_spawner.owner = self;
  554.     bubble_spawner.bubble_count = num_bubbles;
  555.     return;
  556. };
  557.  
  558.  
  559. void() DeathSound =
  560. {
  561. local float        rs;
  562.  
  563.     // water death sounds
  564.     if (self.waterlevel == 3)
  565.     {
  566.         DeathBubbles(20);
  567.         sound (self, CHAN_VOICE, "player/h2odeath.wav", 1, ATTN_NONE);
  568.         return;
  569.     }
  570.     
  571.     rs = rint ((random() * 4) + 1);
  572.     if (rs == 1)
  573.         self.noise = "player/death1.wav";
  574.     if (rs == 2)
  575.         self.noise = "player/death2.wav";
  576.     if (rs == 3)
  577.         self.noise = "player/death3.wav";
  578.     if (rs == 4)
  579.         self.noise = "player/death4.wav";
  580.     if (rs == 5)
  581.         self.noise = "player/death5.wav";
  582.  
  583.     sound (self, CHAN_VOICE, self.noise, 1, ATTN_NONE);
  584.     return;
  585. };
  586.  
  587.  
  588. void() PlayerDead =
  589. {
  590.     self.nextthink = -1;
  591. // allow respawn after a certain time
  592.     self.deadflag = DEAD_DEAD;
  593. };
  594.  
  595. vector(float dm) VelocityForDamage =
  596. {
  597.     local vector v;
  598.  
  599.     v_x = 100 * crandom();
  600.     v_y = 100 * crandom();
  601.     v_z = 200 + 100 * random();
  602.  
  603.     if (dm > -50)
  604.     {
  605. //        dprint ("level 1\n");
  606.         v = v * 0.7;
  607.     }
  608.     else if (dm > -200)
  609.     {
  610. //        dprint ("level 3\n");
  611.         v = v * 2;
  612.     }
  613.     else
  614.         v = v * 10;
  615.  
  616.     return v;
  617. };
  618.  
  619. void() FakeBackpackTouch =
  620. {
  621.         if (other.classname != "player")        // Monsters won't pick up
  622.                 return;
  623.         if (other.health <= 0)                  // Dead people won't pick up
  624.                 return;
  625.         sprint (other, "Hmmmm, empty...\n");
  626.         sound (other, CHAN_ITEM, "weapons/lock4.wav", 1, ATTN_NORM);    // backpack touch sound
  627.         stuffcmd (other, "bf\n");       // flashes the screen
  628.     remove(self);
  629.     
  630. };
  631.  
  632. void(string gibname, float dm) ThrowGib =
  633. {
  634.     local    entity new;
  635.  
  636.     new = spawn();
  637.     new.origin = self.origin;
  638.     setmodel (new, gibname);
  639.     setsize (new, '0 0 0', '0 0 0');
  640.     new.velocity = VelocityForDamage (dm);
  641.     new.movetype = MOVETYPE_BOUNCE;
  642.     new.solid = SOLID_NOT;
  643.     new.avelocity_x = random()*600;
  644.     new.avelocity_y = random()*600;
  645.     new.avelocity_z = random()*600;
  646.     new.think = SUB_Remove;
  647.     new.ltime = time;
  648.     new.nextthink = time + 10 + random()*10;
  649.     new.frame = 0;
  650.     new.flags = 0;
  651. };
  652.  
  653. void(string gibname, float dm) ThrowHeadPlayer =
  654. {
  655.         setmodel (self, gibname);
  656.         self.frame = 0;
  657.         self.nextthink = -1;
  658.         self.movetype = MOVETYPE_BOUNCE;
  659.     self.takedamage = DAMAGE_NO;
  660.     self.solid = SOLID_NOT;
  661.     self.view_ofs = '0 0 8';
  662.     setsize (self, '-16 -16 0', '16 16 56');
  663.     self.velocity = VelocityForDamage (dm);
  664.     self.origin_z = self.origin_z - 24;
  665.     self.flags = self.flags - (self.flags & FL_ONGROUND);
  666.     self.avelocity = crandom() * '0 600 0';
  667. };
  668.  
  669. void(string gibname, float dm) ThrowHead =
  670. {    
  671.         setmodel (self, gibname);
  672.         MakeSolidHead();    //Does just what you think it would.
  673.         self.frame = 0;
  674.         self.skin = self.skin;
  675.         self.nextthink = -1;
  676.         self.view_ofs = '0 0 8';
  677.         self.velocity = VelocityForDamage (dm);
  678.         self.origin_z = self.origin_z - 24;
  679.         self.flags = self.flags - (self.flags & FL_ONGROUND);
  680.         self.avelocity = crandom() * '0 600 0';
  681. };
  682.  
  683.  
  684. void() GibPlayer =
  685. {
  686.         ThrowHeadPlayer ("progs/h_player.mdl", self.health);
  687.     ThrowGib ("progs/gib1.mdl", self.health);
  688.     ThrowGib ("progs/gib2.mdl", self.health);
  689.     ThrowGib ("progs/gib3.mdl", self.health);
  690.     self.deadflag = DEAD_DEAD;
  691.     if (damage_attacker.classname == "teledeath")
  692.     {
  693.         sound (self, CHAN_VOICE, "player/teledth1.wav", 1, ATTN_NONE);
  694.         return;
  695.     }
  696.     if (damage_attacker.classname == "teledeath2")
  697.     {
  698.         sound (self, CHAN_VOICE, "player/teledth1.wav", 1, ATTN_NONE);
  699.         return;
  700.     }
  701.     if (random() < 0.5)
  702.         sound (self, CHAN_VOICE, "player/gib.wav", 1, ATTN_NONE);
  703.     else
  704.         sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NONE);
  705. };
  706.  
  707. void() PlayerDie =
  708. {
  709.     local    float    i;
  710.  
  711.         if (self.flags & FL_ISFEIGN)       // experimental
  712.                feign();
  713.     self.items = self.items - (self.items & IT_INVISIBILITY);
  714.     self.invisible_finished = 0;    // don't die as eyes
  715.     self.invincible_finished = 0;
  716.     self.super_damage_finished = 0;
  717.     self.radsuit_finished = 0;
  718.     self.modelindex = modelindex_player;    // don't use eyes
  719.     if (deathmatch || coop)
  720.         DropBackpack();
  721.     
  722.     self.weaponmodel="";
  723.     self.view_ofs = '0 0 -8';
  724.     self.deadflag = DEAD_DYING;
  725.     self.solid = SOLID_NOT;
  726.     self.flags = self.flags - (self.flags & FL_ONGROUND);
  727.         self.movetype = MOVETYPE_TOSS;
  728.     if (self.velocity_z < 10)
  729.         self.velocity_z = self.velocity_z + random()*300;
  730.         DetPipeBombs();
  731.         if (self.holo >= 1)
  732.            hologram_explode(self.myhologram);
  733.  
  734.     if (self.health < -40)
  735.     {
  736.         GibPlayer ();
  737.         return;
  738.     }
  739.  
  740.     DeathSound();
  741.          
  742.     self.angles_x = 0;
  743.     self.angles_z = 0;
  744.     
  745.         if (self.weapon == IT_AXE || self.weapon == IT_THROWING_AXE || self.weapon == IT_MORNINGSTAR)
  746.     {
  747.         player_die_ax1 ();
  748.         return;
  749.     }
  750.     
  751.     i = cvar("temp1");
  752.     if (!i)
  753.         i = 1 + floor(random()*6);
  754.     
  755.     if (i == 1)
  756.         player_diea1();
  757.     else if (i == 2)
  758.         player_dieb1();
  759.     else if (i == 3)
  760.         player_diec1();
  761.     else if (i == 4)
  762.         player_died1();
  763.     else
  764.         player_diee1();
  765. };
  766.  
  767. void() set_suicide_frame =
  768. {
  769.     if (self.model != "progs/player.mdl")
  770.         return;    // allready gibbed
  771.     self.frame = $deatha11;
  772.     self.solid = SOLID_NOT;
  773.     self.movetype = MOVETYPE_TOSS;
  774.     self.deadflag = DEAD_DEAD;
  775.     self.nextthink = -1;
  776. };
  777.  
  778.  
  779. void()    player_diea1    =    [    $deatha1,    player_diea2    ] {};
  780. void()    player_diea2    =    [    $deatha2,    player_diea3    ] {};
  781. void()    player_diea3    =    [    $deatha3,    player_diea4    ] {};
  782. void()    player_diea4    =    [    $deatha4,    player_diea5    ] {};
  783. void()    player_diea5    =    [    $deatha5,    player_diea6    ] {};
  784. void()    player_diea6    =    [    $deatha6,    player_diea7    ] {};
  785. void()    player_diea7    =    [    $deatha7,    player_diea8    ] {};
  786. void()    player_diea8    =    [    $deatha8,    player_diea9    ] {};
  787. void()    player_diea9    =    [    $deatha9,    player_diea10    ] {};
  788. void()    player_diea10    =    [    $deatha10,    player_diea11    ] {};
  789. void()    player_diea11    =    [    $deatha11,    player_diea11 ] {PlayerDead();};
  790.  
  791. void()    player_dieb1    =    [    $deathb1,    player_dieb2    ] {};
  792. void()    player_dieb2    =    [    $deathb2,    player_dieb3    ] {};
  793. void()    player_dieb3    =    [    $deathb3,    player_dieb4    ] {};
  794. void()    player_dieb4    =    [    $deathb4,    player_dieb5    ] {};
  795. void()    player_dieb5    =    [    $deathb5,    player_dieb6    ] {};
  796. void()    player_dieb6    =    [    $deathb6,    player_dieb7    ] {};
  797. void()    player_dieb7    =    [    $deathb7,    player_dieb8    ] {};
  798. void()    player_dieb8    =    [    $deathb8,    player_dieb9    ] {};
  799. void()    player_dieb9    =    [    $deathb9,    player_dieb9    ] {PlayerDead();};
  800.  
  801. void()    player_diec1    =    [    $deathc1,    player_diec2    ] {};
  802. void()    player_diec2    =    [    $deathc2,    player_diec3    ] {};
  803. void()    player_diec3    =    [    $deathc3,    player_diec4    ] {};
  804. void()    player_diec4    =    [    $deathc4,    player_diec5    ] {};
  805. void()    player_diec5    =    [    $deathc5,    player_diec6    ] {};
  806. void()    player_diec6    =    [    $deathc6,    player_diec7    ] {};
  807. void()    player_diec7    =    [    $deathc7,    player_diec8    ] {};
  808. void()    player_diec8    =    [    $deathc8,    player_diec9    ] {};
  809. void()    player_diec9    =    [    $deathc9,    player_diec10    ] {};
  810. void()    player_diec10    =    [    $deathc10,    player_diec11    ] {};
  811. void()    player_diec11    =    [    $deathc11,    player_diec12    ] {};
  812. void()    player_diec12    =    [    $deathc12,    player_diec13    ] {};
  813. void()    player_diec13    =    [    $deathc13,    player_diec14    ] {};
  814. void()    player_diec14    =    [    $deathc14,    player_diec15    ] {};
  815. void()    player_diec15    =    [    $deathc15,    player_diec15 ] {PlayerDead();};
  816.  
  817. void()    player_died1    =    [    $deathd1,    player_died2    ] {};
  818. void()    player_died2    =    [    $deathd2,    player_died3    ] {};
  819. void()    player_died3    =    [    $deathd3,    player_died4    ] {};
  820. void()    player_died4    =    [    $deathd4,    player_died5    ] {};
  821. void()    player_died5    =    [    $deathd5,    player_died6    ] {};
  822. void()    player_died6    =    [    $deathd6,    player_died7    ] {};
  823. void()    player_died7    =    [    $deathd7,    player_died8    ] {};
  824. void()    player_died8    =    [    $deathd8,    player_died9    ] {};
  825. void()    player_died9    =    [    $deathd9,    player_died9    ] {PlayerDead();};
  826.  
  827. void()    player_diee1    =    [    $deathe1,    player_diee2    ] {};
  828. void()    player_diee2    =    [    $deathe2,    player_diee3    ] {};
  829. void()    player_diee3    =    [    $deathe3,    player_diee4    ] {};
  830. void()    player_diee4    =    [    $deathe4,    player_diee5    ] {};
  831. void()    player_diee5    =    [    $deathe5,    player_diee6    ] {};
  832. void()    player_diee6    =    [    $deathe6,    player_diee7    ] {};
  833. void()    player_diee7    =    [    $deathe7,    player_diee8    ] {};
  834. void()    player_diee8    =    [    $deathe8,    player_diee9    ] {};
  835. void()    player_diee9    =    [    $deathe9,    player_diee9    ] {PlayerDead();};
  836.  
  837. void()    player_die_ax1    =    [    $axdeth1,    player_die_ax2    ] {};
  838. void()    player_die_ax2    =    [    $axdeth2,    player_die_ax3    ] {};
  839. void()    player_die_ax3    =    [    $axdeth3,    player_die_ax4    ] {};
  840. void()    player_die_ax4    =    [    $axdeth4,    player_die_ax5    ] {};
  841. void()    player_die_ax5    =    [    $axdeth5,    player_die_ax6    ] {};
  842. void()    player_die_ax6    =    [    $axdeth6,    player_die_ax7    ] {};
  843. void()    player_die_ax7    =    [    $axdeth7,    player_die_ax8    ] {};
  844. void()    player_die_ax8    =    [    $axdeth8,    player_die_ax9    ] {};
  845. void()    player_die_ax9    =    [    $axdeth9,    player_die_ax9    ] {PlayerDead();};
  846.