home *** CD-ROM | disk | FTP | other *** search
- //====================================================================
- //
- // HOLOGRAPHIC SELF by: Perecli Manole AKA Bort
- //
- //====================================================================
- // Aside from this new file, the following are the modifications
- // done to id's original source files:
- //--------------------------------------------------------------------
- // File: Progs.src
- // Location: before the "weapons.qc" line
- // Added: holo.qc
- //--------------------------------------------------------------------
- // File: Weapons.qc
- // Procedure: ImpulseCommands
- // Location: in the beginning of the function
- // Added: CheckHoloCommand ();
- //--------------------------------------------------------------------
- // File: Client.qc
- // Procedure: SetChangeParms
- // Location: in "// remove items" between "IT_QUAD" and ")"
- // Added: | IT_HOLO
- //--------------------------------------------------------------------
- // File: Defs.qc
- // Declaration group: Item definitions
- // Location: after line float IT_QUAD = 4194304;
- // Added: float IT_HOLO = 8388608;
- //--------------------------------------------------------------------
-
-
- float ACTIVATE_HOLO = 99; // impulse constant
- float SEC = 10; // number of seconds holo is on
- float COST = 10; // number of power cells holo costs
- float CHANCE = 0.7; // frequency of holo shooting (1.0 = continuous)
-
-
- //--------------------------------------------------------------------
- // When time expires holograph gets deactivated
- //--------------------------------------------------------------------
- void() RemoveHolo =
- {
- WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
- WriteByte (MSG_BROADCAST, TE_TELEPORT);
- WriteCoord (MSG_BROADCAST, self.origin_x);
- WriteCoord (MSG_BROADCAST, self.origin_y);
- WriteCoord (MSG_BROADCAST, self.origin_z);
- sound (self, CHAN_BODY, "misc/r_tele1.wav", 1, ATTN_NORM);
- SUB_Remove();
- self.owner.items = self.owner.items - IT_HOLO;
- sprint(self.owner,"holograph expired\n");
- };
-
-
- //--------------------------------------------------------------------
- // Frames for holograph self
- //--------------------------------------------------------------------
- void() holo_stand; // prototype
-
- void() holo_shoot1 = [103, holo_shoot2]
- {
- sound (self ,CHAN_WEAPON, "weapons/spike2.wav", 1, ATTN_NORM);
- self.effects = self.effects | EF_MUZZLEFLASH;
- };
-
- void() holo_shoot2 =
- {
- self.frame = 104;
- if (random() <= CHANCE)
- {
- sound (self ,CHAN_WEAPON, "weapons/spike2.wav", 1, ATTN_NORM);
- self.effects = self.effects | EF_MUZZLEFLASH;
- }
- self.nextthink = time + 0.1;
- if (random() > CHANCE)
- self.think = holo_stand;
- else
- self.think = holo_shoot1;
- self.health = self.health - 0.2;
- if (self.health <= 0)
- RemoveHolo();
- };
-
- void() holo_stand =
- {
- self.frame = 105;
- if (random() > CHANCE)
- self.think = holo_stand;
- else
- self.think = holo_shoot1;
- self.nextthink = time + 0.1;
- self.health = self.health - 0.1;
- if (self.health <= 0)
- RemoveHolo();
- };
-
-
-
- //--------------------------------------------------------------------
- // Spawns holograph self
- //--------------------------------------------------------------------
- void(entity myself) ActivateHolo =
- {
- local entity newholo;
-
- newholo = spawn();
- newholo.solid = SOLID_NOT;
- newholo.movetype = MOVETYPE_TOSS;
- setmodel (newholo, "progs/player.mdl");
- setorigin (newholo, myself.origin);
- setsize (newholo, VEC_HULL_MIN, VEC_HULL_MAX);
- newholo.classname = "holo";
- newholo.angles = myself.angles;
- newholo.velocity = self.velocity + '0 0 200';
- newholo.colormap = myself.colormap;
- newholo.skin = myself.skin;
- newholo.owner=myself;
- newholo.health = SEC;
- myself.currentammo = myself.ammo_cells = myself.ammo_cells - COST;
- myself.items = myself.items | IT_HOLO;
- stuffcmd (newholo.owner, "bf\n");
- sprint(newholo.owner,"holograph activated\n");
- newholo.nextthink = time;
- newholo.think = holo_stand;
- };
-
-
-
- //--------------------------------------------------------------------
- // Checks if holograph should be activated
- //--------------------------------------------------------------------
- void() CheckHoloCommand =
- {
- if (self.impulse != ACTIVATE_HOLO )
- return;
-
- if ((self.items & IT_HOLO) == IT_HOLO)
- {
- sprint(self,"holograph active\n");
- return;
- }
-
- if (self.ammo_cells < COST)
- {
- sprint(self,"cells are low\n");
- return;
- }
-
- ActivateHolo (self);
- };