tarbaby.qc 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368
  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. /*
  16. ==============================================================================
  17. BLOB
  18. ==============================================================================
  19. */
  20. $cd /raid/quake/id1/models/tarbaby
  21. $origin 0 0 24
  22. $base base
  23. //$skin skin
  24. $skin base
  25. $skin skin2
  26. $skin skin
  27. $frame walk1 walk2 walk3 walk4 walk5 walk6 walk7 walk8 walk9 walk10
  28. $frame walk11 walk12 walk13 walk14 walk15 walk16 walk17 walk18 walk19
  29. $frame walk20 walk21 walk22 walk23 walk24 walk25
  30. $frame run1 run2 run3 run4 run5 run6 run7 run8 run9 run10 run11 run12 run13
  31. $frame run14 run15 run16 run17 run18 run19 run20 run21 run22 run23
  32. $frame run24 run25
  33. $frame jump1 jump2 jump3 jump4 jump5 jump6
  34. $frame fly1 fly2 fly3 fly4
  35. $frame exp
  36. void() tbaby_stand1 =[ $walk1, tbaby_stand1 ] {ai_stand();};
  37. void() tbaby_hang1 =[ $walk1, tbaby_hang1 ] {ai_stand();};
  38. void() tbaby_walk1 =[ $walk1, tbaby_walk2 ] {ai_turn();};
  39. void() tbaby_walk2 =[ $walk2, tbaby_walk3 ] {ai_turn();};
  40. void() tbaby_walk3 =[ $walk3, tbaby_walk4 ] {ai_turn();};
  41. void() tbaby_walk4 =[ $walk4, tbaby_walk5 ] {ai_turn();};
  42. void() tbaby_walk5 =[ $walk5, tbaby_walk6 ] {ai_turn();};
  43. void() tbaby_walk6 =[ $walk6, tbaby_walk7 ] {ai_turn();};
  44. void() tbaby_walk7 =[ $walk7, tbaby_walk8 ] {ai_turn();};
  45. void() tbaby_walk8 =[ $walk8, tbaby_walk9 ] {ai_turn();};
  46. void() tbaby_walk9 =[ $walk9, tbaby_walk10 ] {ai_turn();};
  47. void() tbaby_walk10 =[ $walk10, tbaby_walk11 ] {ai_turn();};
  48. void() tbaby_walk11 =[ $walk11, tbaby_walk12 ] {ai_walk(2);};
  49. void() tbaby_walk12 =[ $walk12, tbaby_walk13 ] {ai_walk(2);};
  50. void() tbaby_walk13 =[ $walk13, tbaby_walk14 ] {ai_walk(2);};
  51. void() tbaby_walk14 =[ $walk14, tbaby_walk15 ] {ai_walk(2);};
  52. void() tbaby_walk15 =[ $walk15, tbaby_walk16 ] {ai_walk(2);};
  53. void() tbaby_walk16 =[ $walk16, tbaby_walk17 ] {ai_walk(2);};
  54. void() tbaby_walk17 =[ $walk17, tbaby_walk18 ] {ai_walk(2);};
  55. void() tbaby_walk18 =[ $walk18, tbaby_walk19 ] {ai_walk(2);};
  56. void() tbaby_walk19 =[ $walk19, tbaby_walk20 ] {ai_walk(2);};
  57. void() tbaby_walk20 =[ $walk20, tbaby_walk21 ] {ai_walk(2);};
  58. void() tbaby_walk21 =[ $walk21, tbaby_walk22 ] {ai_walk(2);};
  59. void() tbaby_walk22 =[ $walk22, tbaby_walk23 ] {ai_walk(2);};
  60. void() tbaby_walk23 =[ $walk23, tbaby_walk24 ] {ai_walk(2);};
  61. void() tbaby_walk24 =[ $walk24, tbaby_walk25 ] {ai_walk(2);};
  62. void() tbaby_walk25 =[ $walk25, tbaby_walk1 ] {ai_walk(2);};
  63. void() tbaby_run1 =[ $run1, tbaby_run2 ] {ai_face();};
  64. void() tbaby_run2 =[ $run2, tbaby_run3 ] {ai_face();};
  65. void() tbaby_run3 =[ $run3, tbaby_run4 ] {ai_face();};
  66. void() tbaby_run4 =[ $run4, tbaby_run5 ] {ai_face();};
  67. void() tbaby_run5 =[ $run5, tbaby_run6 ] {ai_face();};
  68. void() tbaby_run6 =[ $run6, tbaby_run7 ] {ai_face();};
  69. void() tbaby_run7 =[ $run7, tbaby_run8 ] {ai_face();};
  70. void() tbaby_run8 =[ $run8, tbaby_run9 ] {ai_face();};
  71. void() tbaby_run9 =[ $run9, tbaby_run10 ] {ai_face();};
  72. void() tbaby_run10 =[ $run10, tbaby_run11 ] {ai_face();};
  73. void() tbaby_run11 =[ $run11, tbaby_run12 ] {ai_run(2);};
  74. void() tbaby_run12 =[ $run12, tbaby_run13 ] {ai_run(2);};
  75. void() tbaby_run13 =[ $run13, tbaby_run14 ] {ai_run(2);};
  76. void() tbaby_run14 =[ $run14, tbaby_run15 ] {ai_run(2);};
  77. void() tbaby_run15 =[ $run15, tbaby_run16 ] {ai_run(2);};
  78. void() tbaby_run16 =[ $run16, tbaby_run17 ] {ai_run(2);};
  79. void() tbaby_run17 =[ $run17, tbaby_run18 ] {ai_run(2);};
  80. void() tbaby_run18 =[ $run18, tbaby_run19 ] {ai_run(2);};
  81. void() tbaby_run19 =[ $run19, tbaby_run20 ] {ai_run(2);};
  82. void() tbaby_run20 =[ $run20, tbaby_run21 ] {ai_run(2);};
  83. void() tbaby_run21 =[ $run21, tbaby_run22 ] {ai_run(2);};
  84. void() tbaby_run22 =[ $run22, tbaby_run23 ] {ai_run(2);};
  85. void() tbaby_run23 =[ $run23, tbaby_run24 ] {ai_run(2);};
  86. void() tbaby_run24 =[ $run24, tbaby_run25 ] {ai_run(2);};
  87. void() tbaby_run25 =[ $run25, tbaby_run1 ] {ai_run(2);};
  88. //============================================================================
  89. void() tbaby_jump1;
  90. void() Tar_JumpTouch =
  91. {
  92. local float ldmg;
  93. if (other.takedamage && other.classname != self.classname)
  94. {
  95. if ( vlen(self.velocity) > 400 )
  96. {
  97. ldmg = 10 + 10*random();
  98. T_Damage (other, self, self, ldmg);
  99. sound (self, CHAN_WEAPON, "blob/hit1.wav", 1, ATTN_NORM);
  100. }
  101. }
  102. else
  103. sound (self, CHAN_WEAPON, "blob/land1.wav", 1, ATTN_NORM);
  104. if (!checkbottom(self))
  105. {
  106. if (self.flags & FL_ONGROUND)
  107. { // jump randomly to not get hung up
  108. //dprint ("popjump\n");
  109. self.touch = SUB_Null;
  110. self.think = tbaby_run1;
  111. self.movetype = MOVETYPE_STEP;
  112. self.nextthink = time + 0.1;
  113. // self.velocity_x = (random() - 0.5) * 600;
  114. // self.velocity_y = (random() - 0.5) * 600;
  115. // self.velocity_z = 200;
  116. // self.flags = self.flags - FL_ONGROUND;
  117. }
  118. return; // not on ground yet
  119. }
  120. self.touch = SUB_Null;
  121. self.think = tbaby_jump1;
  122. self.nextthink = time + 0.1;
  123. };
  124. void() tbaby_jump5;
  125. void() tbaby_fly1 =[ $fly1, tbaby_fly2 ] {};
  126. void() tbaby_fly2 =[ $fly2, tbaby_fly3 ] {};
  127. void() tbaby_fly3 =[ $fly3, tbaby_fly4 ] {};
  128. void() tbaby_fly4 =[ $fly4, tbaby_fly1 ] {
  129. self.cnt = self.cnt + 1;
  130. if (self.cnt == 4)
  131. {
  132. //dprint ("spawn hop\n");
  133. tbaby_jump5 ();
  134. }
  135. };
  136. void() tbaby_jump1 =[ $jump1, tbaby_jump2 ] {ai_face();};
  137. void() tbaby_jump2 =[ $jump2, tbaby_jump3 ] {ai_face();};
  138. void() tbaby_jump3 =[ $jump3, tbaby_jump4 ] {ai_face();};
  139. void() tbaby_jump4 =[ $jump4, tbaby_jump5 ] {ai_face();};
  140. void() tbaby_jump5 =[ $jump5, tbaby_jump6 ]
  141. {
  142. self.movetype = MOVETYPE_BOUNCE;
  143. self.touch = Tar_JumpTouch;
  144. makevectors (self.angles);
  145. self.origin_z = self.origin_z + 1;
  146. self.velocity = v_forward * 600 + '0 0 200';
  147. self.velocity_z = self.velocity_z + random()*150;
  148. if (self.flags & FL_ONGROUND)
  149. self.flags = self.flags - FL_ONGROUND;
  150. self.cnt = 0;
  151. };
  152. void() tbaby_jump6 =[ $jump6,tbaby_fly1 ] {};
  153. //=============================================================================
  154. void() tbaby_die1 =[ $exp, tbaby_die2 ] {
  155. self.takedamage = DAMAGE_NO;
  156. };
  157. void() tbaby_die2 =[ $exp, tbaby_run1 ]
  158. {
  159. T_RadiusDamage (self, self, 120, world);
  160. sound (self, CHAN_VOICE, "blob/death1.wav", 1, ATTN_NORM);
  161. self.origin = self.origin - 8*normalize(self.velocity);
  162. WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  163. WriteByte (MSG_BROADCAST, TE_TAREXPLOSION);
  164. WriteCoord (MSG_BROADCAST, self.origin_x);
  165. WriteCoord (MSG_BROADCAST, self.origin_y);
  166. WriteCoord (MSG_BROADCAST, self.origin_z);
  167. BecomeExplosion ();
  168. };
  169. //=============================================================================
  170. void() tbaby_mitosis;
  171. void() tbaby_checknew =
  172. {
  173. if (!walkmove(0,0))
  174. {
  175. remove(self);
  176. return;
  177. }
  178. self.enemy = self.enemy;
  179. self.th_stand = tbaby_stand1;
  180. self.th_walk = tbaby_walk1;
  181. self.th_run = tbaby_run1;
  182. self.th_missile = tbaby_jump1;
  183. self.th_melee = tbaby_jump1;
  184. self.th_die = tbaby_die1;
  185. self.origin_z = self.origin_z + 1; // raise off floor a bit
  186. droptofloor();
  187. if (!walkmove(0,0))
  188. {
  189. self.owner.th_pain = tbaby_mitosis;
  190. remove(self);
  191. return;
  192. }
  193. self.takedamage = DAMAGE_AIM;
  194. self.ideal_yaw = self.angles * '0 1 0';
  195. if (!self.yaw_speed)
  196. self.yaw_speed = 20;
  197. self.view_ofs = '0 0 25';
  198. self.use = monster_use;
  199. self.flags = self.flags | FL_MONSTER;
  200. self.pausetime = 99999999;
  201. self.th_stand ();
  202. self.nextthink = self.nextthink + random()*0.5;
  203. total_monsters = total_monsters + 1;
  204. WriteByte (MSG_BROADCAST, SVC_UPDATESTAT);
  205. WriteByte (MSG_BROADCAST, STAT_TOTALMONSTERS);
  206. WriteLong (MSG_BROADCAST, total_monsters);
  207. };
  208. void() tbaby_mitosis =
  209. {
  210. local entity newSpawn;
  211. if ( random() < 0.35 )
  212. {
  213. newSpawn = spawn();
  214. newSpawn.classname = self.classname;
  215. newSpawn.movetype = MOVETYPE_STEP;
  216. setsize (newSpawn, '-16 -16 -24', '16 16 40');
  217. newSpawn.health = 80;
  218. if (self.skin == 1)
  219. newSpawn.health = 60;
  220. else if (self.skin == 2)
  221. newSpawn.health = 100;
  222. newSpawn.owner = self;
  223. self.th_pain = SUB_Null;
  224. setmodel (newSpawn, "progs/tarbaby.mdl");
  225. newSpawn.solid = SOLID_SLIDEBOX;
  226. newSpawn.skin = self.skin;
  227. setorigin (newSpawn, self.origin);
  228. newSpawn.think = tbaby_checknew;
  229. newSpawn.nextthink = time + 0.5;
  230. sound (newSpawn, CHAN_VOICE, "blob/mytosis.wav", 1, ATTN_NORM);
  231. }
  232. };
  233. /*QUAKED monster_tarbaby (1 0 0) (-16 -16 -24) (16 16 24) Ambush Blue Green Spots
  234. The Spawn (and hellspawn)
  235. The spawn type is random by default.
  236. If you want a specific type, select "Blue", "Green", or "Spots".
  237. */
  238. void() monster_tarbaby =
  239. {
  240. local float myRand;
  241. local float skillLevel;
  242. if (deathmatch)
  243. {
  244. remove(self);
  245. return;
  246. }
  247. precache_model2 ("progs/tarbaby.mdl");
  248. precache_sound2 ("blob/death1.wav");
  249. precache_sound2 ("blob/hit1.wav");
  250. precache_sound2 ("blob/land1.wav");
  251. precache_sound2 ("blob/sight1.wav");
  252. precache_sound2 ("blob/mytosis.wav");
  253. self.solid = SOLID_SLIDEBOX;
  254. self.movetype = MOVETYPE_STEP;
  255. setmodel (self, "progs/tarbaby.mdl");
  256. setsize (self, '-16 -16 -24', '16 16 40');
  257. self.health = 80;
  258. self.th_stand = tbaby_stand1;
  259. self.th_walk = tbaby_walk1;
  260. self.th_run = tbaby_run1;
  261. self.th_missile = tbaby_jump1;
  262. self.th_melee = tbaby_jump1;
  263. self.th_die = tbaby_die1;
  264. if (self.spawnflags & 8)
  265. {
  266. self.th_pain = tbaby_mitosis;
  267. self.skin = 2;
  268. self.health = 100;
  269. }
  270. else if (self.spawnflags & 4)
  271. {
  272. self.th_pain = tbaby_mitosis;
  273. self.skin = 1;
  274. self.health = 60;
  275. }
  276. else if (self.spawnflags & 2)
  277. {
  278. self.skin = 0;
  279. }
  280. else
  281. {
  282. skillLevel = cvar ( "skill" );
  283. myRand = skillLevel * 0.2;
  284. myRand = myRand + random();
  285. if (myRand > 0.8 && skillLevel > 1)
  286. {
  287. self.th_pain = tbaby_mitosis;
  288. self.skin = 2;
  289. self.health = 100;
  290. }
  291. else if (myRand > 0.5)
  292. {
  293. self.th_pain = tbaby_mitosis;
  294. self.skin = 1;
  295. self.health = 60;
  296. }
  297. else
  298. {
  299. self.skin = 0;
  300. }
  301. }
  302. walkmonster_start ();
  303. };