home *** CD-ROM | disk | FTP | other *** search
/ Quake 'em / QUAKEEM.BIN / quake / programs / holo2 / holo.qc next >
Encoding:
Text File  |  1996-08-14  |  3.4 KB  |  108 lines

  1. //====================================================================
  2. //
  3. // HOLOGRAPHIC SELF            by: Perecli Manole AKA Bort
  4. //
  5. //====================================================================
  6. // Aside from this new file, the following are the modifications
  7. // done to id's original source files:
  8. //--------------------------------------------------------------------
  9. // File: Progs.src
  10. // Location: before the "weapons.qc" line
  11. // Added: holo.qc
  12. //--------------------------------------------------------------------
  13. // File: Weapons.qc
  14. // Procedure: ImpulseCommands
  15. // Location: first line in the function
  16. // Added: CheckHoloCommand ();
  17. //--------------------------------------------------------------------
  18.  
  19.  
  20. float   ACTIVATE_HOLO = 99;    // impulse constant
  21. float    SEC = 10;        // number of seconds holo is on
  22. float    COST = 10;        // number of power cells holo costs
  23. float    IT_HOLO = 8388608;    // holo bit mask flageee
  24. float   IT_HOLO_neg = 8388607;    // negative holo bit mask flag
  25.  
  26.  
  27. //--------------------------------------------------------------------
  28. // When time expires holograph gets deactivated
  29. //--------------------------------------------------------------------
  30. void() RemoveHolo =
  31. {
  32.     WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  33.     WriteByte (MSG_BROADCAST, TE_TELEPORT);
  34.     WriteCoord (MSG_BROADCAST, self.origin_x);
  35.     WriteCoord (MSG_BROADCAST, self.origin_y);
  36.     WriteCoord (MSG_BROADCAST, self.origin_z);
  37.     sound (self, CHAN_BODY, "misc/r_tele1.wav", 1, ATTN_NORM);
  38.     SUB_Remove();
  39.     self.owner.items = self.owner.items & IT_HOLO_neg;
  40.     sprint(self.owner,"holograph expired\n");
  41. };
  42.  
  43.  
  44. //--------------------------------------------------------------------
  45. // Frames for holograph self
  46. //--------------------------------------------------------------------
  47. void() holo_stand1 = [12, holo_stand2] {};  
  48. void() holo_stand2 = [13, holo_stand3] {};
  49. void() holo_stand3 = [14, holo_stand4] {};
  50. void() holo_stand4 = [15, holo_stand5] {};
  51. void() holo_stand5 = [16, holo_stand1] 
  52. {
  53.     self.health = self.health - 0.5;
  54.     if (self.health <= 0)    
  55.         RemoveHolo();    
  56. };
  57.  
  58.  
  59. //--------------------------------------------------------------------
  60. // Spawns holograph self
  61. //--------------------------------------------------------------------
  62. void(entity myself) ActivateHolo =
  63. {
  64.     local entity    newholo;
  65.  
  66.     newholo = spawn();
  67.     newholo.solid = SOLID_NOT;
  68.     newholo.movetype = MOVETYPE_NOCLIP;
  69.     newholo.origin = myself.origin;
  70.     newholo.angles = myself.angles;
  71.     newholo.colormap = myself.colormap;
  72.     newholo.skin = myself.skin;
  73.     setmodel (newholo, "progs/player.mdl");
  74.     newholo.classname = "holo";
  75.     newholo.owner=myself;
  76.     newholo.health = SEC;
  77.     myself.currentammo = myself.ammo_cells = myself.ammo_cells - COST;
  78.     myself.items = myself.items | IT_HOLO;
  79.     stuffcmd (newholo.owner, "bf\n");
  80.     sprint(newholo.owner,"holograph activated\n");
  81.     newholo.nextthink = time;    
  82.     newholo.think = holo_stand1;    
  83. };
  84.  
  85.  
  86.  
  87. //--------------------------------------------------------------------
  88. // Checks if holograph should be activated
  89. //--------------------------------------------------------------------
  90. void() CheckHoloCommand = 
  91. {
  92.     if (self.impulse != ACTIVATE_HOLO )
  93.         return;
  94.  
  95.     if ((self.items & IT_HOLO) == IT_HOLO)
  96.     {
  97.         sprint(self,"holograph active\n");
  98.         return;
  99.     }
  100.  
  101.     if (self.ammo_cells < 10)
  102.     {
  103.         sprint(self,"cells are low\n");
  104.         return;
  105.     }
  106.     
  107.     ActivateHolo (self);
  108. };