home *** CD-ROM | disk | FTP | other *** search
/ Quake 'em / QUAKEEM.BIN / quake / programs / feign_v9 / feign.qc < prev    next >
Encoding:
Text File  |  1996-08-01  |  6.0 KB  |  148 lines

  1. // This is my poor attempt to add something useful 
  2.  
  3. // Globals
  4.  
  5. .float isfeign;
  6. .string oldweaponmodel;         // change to local?
  7. .float oldweapon;               // change to local?
  8.  
  9. // Frames
  10. //
  11. //      I had to re-init them all to be able to call them.
  12. // If I had this function in player.qc, this wouldn't be
  13. // necessary, but then it would be less modular.
  14.  
  15. $cd /raid/quake/id1/models/player_4
  16. $origin 0 -6 24
  17. $base base        
  18. $skin skin
  19.  
  20. $frame axrun1 axrun2 axrun3 axrun4 axrun5 axrun6
  21. $frame rockrun1 rockrun2 rockrun3 rockrun4 rockrun5 rockrun6
  22. $frame stand1 stand2 stand3 stand4 stand5
  23. $frame axstnd1 axstnd2 axstnd3 axstnd4 axstnd5 axstnd6
  24. $frame axstnd7 axstnd8 axstnd9 axstnd10 axstnd11 axstnd12
  25. $frame axpain1 axpain2 axpain3 axpain4 axpain5 axpain6
  26. $frame pain1 pain2 pain3 pain4 pain5 pain6
  27. $frame axdeth1 axdeth2 axdeth3 axdeth4 axdeth5 axdeth6
  28. $frame axdeth7 axdeth8 axdeth9
  29. $frame deatha1 deatha2 deatha3 deatha4 deatha5 deatha6 deatha7 deatha8
  30. $frame deatha9 deatha10 deatha11
  31. $frame deathb1 deathb2 deathb3 deathb4 deathb5 deathb6 deathb7 deathb8
  32. $frame deathb9
  33. $frame deathc1 deathc2 deathc3 deathc4 deathc5 deathc6 deathc7 deathc8
  34. $frame deathc9 deathc10 deathc11 deathc12 deathc13 deathc14 deathc15
  35. $frame deathd1 deathd2 deathd3 deathd4 deathd5 deathd6 deathd7
  36. $frame deathd8 deathd9
  37. $frame deathe1 deathe2 deathe3 deathe4 deathe5 deathe6 deathe7
  38. $frame deathe8 deathe9
  39. $frame nailatt1 nailatt2
  40. $frame light1 light2
  41. $frame rockatt1 rockatt2 rockatt3 rockatt4 rockatt5 rockatt6
  42. $frame shotatt1 shotatt2 shotatt3 shotatt4 shotatt5 shotatt6
  43. $frame axatt1 axatt2 axatt3 axatt4 axatt5 axatt6
  44. $frame axattb1 axattb2 axattb3 axattb4 axattb5 axattb6
  45. $frame axattc1 axattc2 axattc3 axattc4 axattc5 axattc6
  46. $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
  47.  
  48.  
  49. // Falling down animation.  Any would have done.
  50.  
  51. void()  player_feigna1    =       [       $deatha1,       player_feigna2    ] {};
  52. void()  player_feigna2    =       [       $deatha2,       player_feigna3    ] {};
  53. void()  player_feigna3    =       [       $deatha3,       player_feigna4    ] {};
  54. void()  player_feigna4    =       [       $deatha4,       player_feigna5    ] {};
  55. void()  player_feigna5    =       [       $deatha5,       player_feigna6    ] {};
  56. void()  player_feigna6    =       [       $deatha6,       player_feigna7    ] {};
  57. void()  player_feigna7    =       [       $deatha7,       player_feigna8    ] {};
  58. void()  player_feigna8    =       [       $deatha8,       player_feigna9    ] {};
  59. void()  player_feigna9    =       [       $deatha9,       player_feigna10   ] {};
  60. void()  player_feigna10   =       [       $deatha10,      player_feigna11   ] {};
  61. void()  player_feigna11   =       [       $deatha11,      player_feigna11   ] {};
  62.  
  63.  
  64. // Standing up animation.  This one looks the best.
  65.  
  66. void()  player_upa1    =       [       $deathd9,        player_upa2    ] {};
  67. void()  player_upa2    =       [       $deathd8,        player_upa3    ] {};
  68. void()  player_upa3    =       [       $deathd7,        player_upa4    ] {};
  69. void()  player_upa4    =       [       $deathd6,        player_upa5    ] {};
  70. void()  player_upa5    =       [       $deathd5,        player_upa6    ] {};
  71. void()  player_upa6    =       [       $deathd4,        player_upa7    ] {};
  72. void()  player_upa7    =       [       $deathd3,        player_upa8    ] {};
  73. void()  player_upa8    =       [       $deathd2,        player_upa9    ] {};
  74. void()  player_upa9    =       [       $deathd1,        player_upa9    ] {player_stand1 ();};
  75.  
  76.  
  77. //      I had to make new backpack routines so that you wouldn't give up 
  78. // your ammo, pick it up while you're throwing it, and have a neat message.
  79.  
  80. void() FakeBackpackTouch =
  81. {
  82.         if (other.classname != "player")        // Monsters won't pick up
  83.         return;
  84.         if (other.health <= 0)                  // Dead people won't pick up
  85.         return;
  86.         if ( (self.owner == other) && ( (self.nextthink - time) > 99 ) )        // The thrower won't pick up
  87.                 return;                                                         // unless 20 sec has passed.
  88.  
  89.         sprint (other, "Hmmmm, empty...\n");
  90.         sound (other, CHAN_ITEM, "weapons/lock4.wav", 1, ATTN_NORM);    // backpack touch sound
  91.         stuffcmd (other, "bf\n");       // flashes the screen
  92.     remove(self);
  93.     
  94. };
  95.  
  96.  
  97. void() FakeBackpack =
  98. {
  99.     local entity    item;
  100.  
  101.     item = spawn();
  102.         item.owner = self;
  103.         item.origin = self.origin - '0 0 24';
  104.     item.velocity_z = 300;
  105.     item.velocity_x = -100 + (random() * 200);
  106.     item.velocity_y = -100 + (random() * 200);
  107.     item.flags = FL_ITEM;
  108.     item.solid = SOLID_TRIGGER;
  109.         item.movetype = MOVETYPE_TOSS;
  110.     setmodel (item, "progs/backpack.mdl");
  111.     setsize (item, '-16 -16 0', '16 16 56');
  112.         item.touch = FakeBackpackTouch;
  113.     item.nextthink = time + 120;    // remove after 2 minutes
  114.     item.think = SUB_Remove;
  115. };
  116.  
  117. void() feign =
  118. {
  119.         if (!self.isfeign)              // If not already, feign death
  120.         {
  121.                 player_feigna1 ();      // death animation
  122.                 FakeBackpack();         // throw fake backpack
  123.                 setsize (self , '-16 -16 -4' , '16 16 4');      // change bounding bos so you're shorter
  124.                 self.view_ofs = '0 0 2';        // put view near ground
  125.                 DeathSound();           // yell like you're dying
  126.                 self.oldweapon = self.weapon;   
  127.                 self.weapon = 0;
  128.                 self.oldweaponmodel = self.weaponmodel;
  129.                 self.weaponmodel = "";
  130.                 self.movetype = MOVETYPE_TOSS;
  131.                 self.isfeign = TRUE;
  132.         }
  133.  
  134.         else                    // otherwise, get up
  135.  
  136.         {
  137.                 self.movetype = MOVETYPE_WALK;
  138.                 setsize (self, VEC_HULL_MIN, VEC_HULL_MAX);
  139.                 self.view_ofs = '0 0 22';
  140.                 self.weaponmodel = self.oldweaponmodel;
  141.                 self.weapon = self.oldweapon;
  142.                 self.oldweapon = 0;
  143.                 self.isfeign = FALSE;
  144.                 player_upa1();
  145.         }
  146. };
  147.  
  148.