home *** CD-ROM | disk | FTP | other *** search
/ Quake 'em / QUAKEEM.BIN / quake / programs / holo1 / holo.qc next >
Encoding:
Text File  |  1996-08-11  |  2.6 KB  |  91 lines

  1. /*
  2.  
  3. ==============================================================================
  4.  
  5. HOLOGRAPHIC SELF
  6.  
  7. ==============================================================================
  8.  
  9. Procedure for integrating this rc file with the others
  10. 1. Put this file in the same directory with the other .qc files
  11. 2. In Progs.src add a new line "holo.qc" right before the line "weapons.qc"
  12. 3. In weapons.qc, add "CheckHoloCommand ();" as the first line in the function
  13.    ImpulseCommands
  14. 4. Recompile
  15. 5. Bind key to Impulse 99
  16.  
  17. */
  18.  
  19.  
  20. float   ACTIVATE_HOLO = 99;    // impulse constant
  21. float    IT_HOLO = 8388608;    // holo bit mask flag
  22. float   IT_HOLO_neg = 8388607;    // negative holo bit mask flag
  23.  
  24.  
  25. //--------------------------------------------------------------------
  26. // When time expires holograph gets deactivated
  27. //--------------------------------------------------------------------
  28. void() RemoveHolo =
  29. {
  30.     WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  31.         WriteByte (MSG_BROADCAST, TE_TELEPORT);
  32.         WriteCoord (MSG_BROADCAST, self.origin_x);
  33.         WriteCoord (MSG_BROADCAST, self.origin_y);
  34.         WriteCoord (MSG_BROADCAST, self.origin_z);
  35.     sound (self, CHAN_BODY, "misc/r_tele1.wav", 1, ATTN_NORM);
  36.     SUB_Remove();
  37.     self.owner.items = self.owner.items & IT_HOLO_neg;
  38.     sprint(self.owner,"holograph expired\n");
  39. };
  40.  
  41.  
  42.  
  43. //--------------------------------------------------------------------
  44. // Spawns holograph self
  45. //--------------------------------------------------------------------
  46. void(entity myself) ActivateHolo =
  47. {
  48.     local entity    newholo;
  49.  
  50.     newholo = spawn();
  51.     newholo.solid = SOLID_NOT;
  52.     newholo.movetype = MOVETYPE_NOCLIP;
  53.     newholo.origin = myself.origin;
  54.     newholo.angles = myself.angles;
  55.     newholo.colormap = myself.colormap;
  56.     setmodel (newholo, "progs/player.mdl");
  57.     newholo.classname = "holo";
  58.     newholo.owner=myself;
  59.     newholo.frame=13;
  60.     newholo.nextthink = time + 10;    
  61.     newholo.think = RemoveHolo;
  62.     myself.currentammo = myself.ammo_cells = myself.ammo_cells - 10;
  63.     myself.items = myself.items | IT_HOLO;
  64.     stuffcmd (newholo.owner, "bf\n");
  65.     sprint(newholo.owner,"holograph activated\n");
  66. };
  67.  
  68.  
  69.  
  70. //--------------------------------------------------------------------
  71. // Checks if holograph should be activated
  72. //--------------------------------------------------------------------
  73. void() CheckHoloCommand = 
  74. {
  75.     if (self.impulse != ACTIVATE_HOLO )
  76.         return;
  77.  
  78.     if ((self.items & IT_HOLO) == IT_HOLO)
  79.     {
  80.         sprint(self,"holograph active\n");
  81.         return;
  82.     }
  83.  
  84.     if (self.ammo_cells < 10)
  85.     {
  86.         sprint(self,"cells are low\n");
  87.         return;
  88.     }
  89.     
  90.     ActivateHolo (self);
  91. };