eel.qc 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. /* Copyright (C) 1996-2022 id Software LLC
  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. $cd /qwork/xpack/models/eel
  16. $origin 0 0 0
  17. $scale .12
  18. $base eelrest3
  19. $skin eelfin
  20. $frame eelswim1 eelswim2 eelswim3 eelswim4 eelswim5 eelswim6
  21. $frame eeldth1 eeldth2 eeldth3 eeldth4 eeldth5
  22. $frame eeldth6 eeldth7 eeldth8 eeldth9 eeldth10
  23. void() swimmonster_start;
  24. void() eel_pain1;
  25. void() eel_pitch_change =
  26. {
  27. if ( pointcontents ( self.origin ) != CONTENT_WATER )
  28. {
  29. droptofloor();
  30. T_Damage ( self, world, world, 6);
  31. return;
  32. }
  33. if ( time < self.delay )
  34. return;
  35. if ( self.weapon > 10 )
  36. self.weapon = -10;
  37. if ( self.weapon < 0 )
  38. self.angles_x = self.angles_x - 1.5;
  39. else if ( self.weapon > 0)
  40. self.angles_x = self.angles_x + 1.5;
  41. self.weapon = self.weapon + 1;
  42. };
  43. void() eel_stand1 =[ $eelswim1, eel_stand2 ]
  44. { ai_stand(); eel_pitch_change();} ;
  45. void() eel_stand2 =[ $eelswim2, eel_stand3 ]
  46. { ai_stand(); eel_pitch_change();};
  47. void() eel_stand3 =[ $eelswim3, eel_stand4 ]
  48. { ai_stand(); eel_pitch_change();};
  49. void() eel_stand4 =[ $eelswim4, eel_stand5 ]
  50. { ai_stand(); eel_pitch_change();};
  51. void() eel_stand5 =[ $eelswim5, eel_stand6 ]
  52. { ai_stand(); eel_pitch_change();};
  53. void() eel_stand6 =[ $eelswim6, eel_stand1 ]
  54. { ai_stand(); eel_pitch_change();};
  55. void() eel_walk1 =[ $eelswim1, eel_walk2 ]
  56. {
  57. if (random() < 0.2)
  58. sound (self, CHAN_VOICE, "eel/eactive1.wav", 1, ATTN_IDLE);
  59. ai_walk(6);
  60. eel_pitch_change();
  61. };
  62. void() eel_walk2 =[ $eelswim2, eel_walk3 ] {ai_walk(6);eel_pitch_change();};
  63. void() eel_walk3 =[ $eelswim3, eel_walk4 ] {ai_walk(6);eel_pitch_change();};
  64. void() eel_walk4 =[ $eelswim4, eel_walk5 ] {ai_walk(6);eel_pitch_change();};
  65. void() eel_walk5 =[ $eelswim5, eel_walk6 ] {ai_walk(6);eel_pitch_change();};
  66. void() eel_walk6 =[ $eelswim6, eel_walk1 ] {ai_walk(6);eel_pitch_change();};
  67. void() eel_run1 =[ $eelswim1, eel_run2 ]
  68. {
  69. if (random() < 0.4)
  70. sound (self, CHAN_VOICE, "eel/eactive1.wav", 1, ATTN_IDLE);
  71. ai_run(10);
  72. eel_pitch_change();
  73. };
  74. void() eel_run2 =[ $eelswim2, eel_run3 ] {ai_run(10);eel_pitch_change();};
  75. void() eel_run3 =[ $eelswim3, eel_run4 ] {ai_run(10);eel_pitch_change();};
  76. void() eel_run4 =[ $eelswim4, eel_run5 ] {ai_run(10);eel_pitch_change();};
  77. void() eel_run5 =[ $eelswim5, eel_run6 ] {ai_run(10);eel_pitch_change();};
  78. void() eel_run6 =[ $eelswim6, eel_run1 ] {ai_run(10);eel_pitch_change();};
  79. void() eel_melee =
  80. {
  81. local float attackOK;
  82. attackOK = 1;
  83. traceline (self.origin, self.enemy.origin, FALSE, self);
  84. if (trace_ent != self.enemy)
  85. attackOK = FALSE; // don't have a clear shot
  86. if (trace_inopen && trace_inwater)
  87. attackOK = FALSE; // sight line crossed contents
  88. if (attackOK)
  89. T_EELZap (self, self, 45);
  90. self.skin=0;
  91. self.effects=0;
  92. };
  93. void() eel_attack1 =[ $eelswim1, eel_attack2 ]
  94. { ai_charge(8); eel_pitch_change();};
  95. void() eel_attack2 =[ $eelswim2, eel_attack3 ]
  96. { ai_charge(8); eel_pitch_change();};
  97. void() eel_attack3 =[ $eelswim3, eel_attack4 ]
  98. { ai_charge(8); eel_pitch_change();};
  99. void() eel_attack4 =[ $eelswim4, eel_attack5 ]
  100. { ai_charge(8); eel_pitch_change();};
  101. void() eel_attack5 =[ $eelswim5, eel_attack6 ]
  102. { ai_charge(8); eel_pitch_change();};
  103. void() eel_attack6 =[ $eelswim6, eel_attack7 ]
  104. { ai_charge(8); eel_pitch_change();};
  105. void() eel_attack7 =[ $eelswim1, eel_attack8 ]
  106. { ai_charge(8); eel_pitch_change();};
  107. void() eel_attack8 =[ $eelswim2, eel_attack9 ]
  108. {
  109. self.effects = EF_DIMLIGHT;
  110. self.skin=1;
  111. ai_charge(8);
  112. eel_pitch_change();
  113. sound (self, CHAN_WEAPON, "eel/eatt1.wav", 1, ATTN_NORM);
  114. };
  115. void() eel_attack9 =[ $eelswim3, eel_attack10 ]
  116. { self.skin=2;ai_charge(8);eel_pitch_change(); };
  117. void() eel_attack10=[ $eelswim4, eel_attack11 ]
  118. { self.skin=3;ai_charge(8);eel_pitch_change(); };
  119. void() eel_attack11=[ $eelswim5, eel_attack12 ]
  120. { self.effects = EF_BRIGHTLIGHT; self.skin=4;ai_charge(8);eel_pitch_change();};
  121. void() eel_attack12=[ $eelswim6, eel_run1 ]
  122. { self.skin=5;eel_melee(); };
  123. void() eel_death1 =[ $eeldth1, eel_death2 ]
  124. {
  125. self.skin = 0;
  126. self.effects = 0;
  127. sound (self, CHAN_VOICE, "eel/edie3r.wav", 1, ATTN_NORM);
  128. };
  129. void() eel_death2 =[ $eeldth2, eel_death3 ] {};
  130. void() eel_death3 =[ $eeldth3, eel_death4 ] {};
  131. void() eel_death4 =[ $eeldth4, eel_death5 ] {};
  132. void() eel_death5 =[ $eeldth3, eel_death6 ] {};
  133. void() eel_death6 =[ $eeldth2, eel_death7 ] {};
  134. void() eel_death7 =[ $eeldth1, eel_death8 ] {};
  135. void() eel_death8 =[ $eeldth2, eel_death9 ] {};
  136. void() eel_death9 =[ $eeldth3, eel_death10 ] {};
  137. void() eel_death10 =[ $eeldth4, eel_death11 ] {};
  138. void() eel_death11 =[ $eeldth5, eel_death12 ] { self.flags = self.flags - FL_SWIM; };
  139. void() eel_death12 =[ $eeldth6, eel_death13 ] {};
  140. void() eel_death13 =[ $eeldth7, eel_death14 ] {};
  141. void() eel_death14 =[ $eeldth8, eel_death15 ] {};
  142. void() eel_death15 =[ $eeldth9, eel_death16 ] {droptofloor();};
  143. void() eel_death16 =[ $eeldth10, eel_death16 ] {self.solid = SOLID_NOT;};
  144. void() eel_death =
  145. {
  146. self.flags = self.flags + FL_SWIM;
  147. setsize (self, '0 0 0', '0 0 0');
  148. // self.skin = 1; // change to bloody eel skin!
  149. if (self.health < -12)
  150. {
  151. self.skin = 0;
  152. self.effects = 0;
  153. ThrowHead ("progs/eelgib.mdl", self.health);
  154. ThrowGib ("progs/gib1.mdl", self.health);
  155. ThrowGib ("progs/gib1.mdl", self.health);
  156. ThrowGib ("progs/gib1.mdl", self.health);
  157. return;
  158. }
  159. else
  160. {
  161. eel_death1 ();
  162. }
  163. };
  164. void() eel_pain1 =[ $eeldth1, eel_pain2 ]
  165. {
  166. if (self.pain_finished > time)
  167. return;
  168. self.pain_finished = time + 1;
  169. sound (self, CHAN_VOICE, "eel/epain3.wav", 1, ATTN_NORM);
  170. self.skin=0;
  171. };
  172. void() eel_pain2 =[ $eeldth2, eel_pain3 ] {};
  173. void() eel_pain3 =[ $eeldth3, eel_pain4 ] {};
  174. void() eel_pain4 =[ $eeldth4, eel_pain5 ] {};
  175. void() eel_pain5 =[ $eeldth3, eel_pain6 ] {};
  176. void() eel_pain6 =[ $eeldth2, eel_pain7 ] {};
  177. void() eel_pain7 =[ $eeldth1, eel_run1 ] {};
  178. /*QUAKED monster_eel (1 0 0) (-16 -16 -24) (16 16 32) Ambush
  179. */
  180. void() monster_eel =
  181. {
  182. if (deathmatch)
  183. {
  184. remove(self);
  185. return;
  186. }
  187. precache_model ("progs/eel2.mdl");
  188. precache_model ("progs/eelgib.mdl");
  189. precache_model ("progs/gib1.mdl");
  190. precache_sound ("eel/edie3r.wav");
  191. precache_sound ("eel/epain3.wav");
  192. precache_sound ("eel/eactive1.wav");
  193. precache_sound ("eel/eatt1.wav");
  194. precache_sound ("eel/eelc5.wav");
  195. self.solid = SOLID_SLIDEBOX;
  196. self.movetype = MOVETYPE_STEP;
  197. setmodel (self, "progs/eel2.mdl");
  198. setsize (self, VEC_HULL_MIN, VEC_HULL_MAX);
  199. self.health = 60;
  200. self.th_stand = eel_stand1;
  201. self.th_walk = eel_walk1;
  202. self.th_run = eel_run1;
  203. self.th_die = eel_death;
  204. self.th_pain = eel_pain1;
  205. self.th_melee = eel_attack1;
  206. self.delay = time + random() * 6;
  207. self.weapon = 0;
  208. swimmonster_start ();
  209. };