djcev.com

//

Git Repos / fte_dogmode / qc / hazards / shooter.qc

Last update to this file was on 2024-11-20 at 23:54.

Show shooter.qc

//==============================================================================
// trap_spikeshooter from Hipnotic -- with additions by dumptruck_ds
//==============================================================================

// MED 11/09/96 added new spawnflags -- taken from hipdefs.qc - dumptruck_ds

//======================================================================
// constants
//======================================================================

#ifdef SSQC
const float SHOOTER_SPAWNFLAG_SUPERSPIKE = 1;
const float SHOOTER_SPAWNFLAG_LASER = 2;
const float SHOOTER_SPAWNFLAG_LAVABALL = 4;
const float SHOOTER_SPAWNFLAG_ROCKET = 8;
const float SHOOTER_SPAWNFLAG_VOREBALL = 16;
const float SHOOTER_SPAWNFLAG_GRENADE = 32;
const float SHOOTER_SPAWNFLAG_GIBS = 64;
const float SHOOTER_SPAWNFLAG_SILENT = 128;
#endif

//======================================================================
// forward declarations
//======================================================================

// base_hazard_shooter
#ifdef SSQC
void() base_hazard_shooter_think;
void() base_hazard_shooter_use;
void(entity e) base_hazard_shooter_init;
strip void() base_hazard_shooter;
#endif

// trap_spikeshooter
#ifdef SSQC
void(entity e) trap_spikeshooter_init;
void() trap_spikeshooter;
#endif

// trap_shooter
#ifdef SSQC
void(entity e) trap_shooter_init;
void() trap_shooter;
#endif

// trap_switched_shooter
#ifdef SSQC
void() trap_switched_shooter_use;
void(entity e) trap_switched_shooter_init;
void() trap_switched_shooter;
#endif

//------------------------------------------------------------------------------

//----------------------------------------------------------------------
// class base_hazard_shooter: base_mapentity
// {
#ifdef SSQC
//--------------------------------------------------------------
// shooter_think -- MED 11/01/96 added state capability
//--------------------------------------------------------------
void() base_hazard_shooter_think =
{
if (self.state)
// call the use/firing function directly -- CEV
base_hazard_shooter_use ();

self.nextthink = time + self.wait;
};

//--------------------------------------------------------------
// spikeshooter_use
// MED 11/09/96 added lava ball and rocket
// dumptruck_ds added voreball and grenades
//--------------------------------------------------------------
void() base_hazard_shooter_use =
{
if (self.spawnflags & SHOOTER_SPAWNFLAG_LASER)
{
if (!(self.spawnflags & SHOOTER_SPAWNFLAG_SILENT))
sound (self, CHAN_VOICE, "enforcer/enfire.wav",
VOL_HIGH, ATTN_NORM);

local vector laser_velocity = normalize (self.movedir);
// SetSpeed
laser_velocity *= min (LASER_SPEED *
self.proj_speed_mod, PM_MAXVELOCITY);

// fire_laser
spawn_projectile_laser (self, self.origin,
laser_velocity);
}
else if (self.spawnflags & SHOOTER_SPAWNFLAG_LAVABALL)
{
if (!(self.spawnflags & SHOOTER_SPAWNFLAG_SILENT))
// dms
sound (self, CHAN_VOICE, "boss1/throw.wav",
VOL_HIGH, ATTN_NORM);

spawn_projectile_lavaball (self, self.origin,
self.movedir * 600);
}
else if (self.spawnflags & SHOOTER_SPAWNFLAG_ROCKET)
{
if (!(self.spawnflags & SHOOTER_SPAWNFLAG_SILENT))
sound (self, CHAN_VOICE, "weapons/sgun1.wav",
VOL_HIGH, ATTN_NORM);

spawn_projectile_rocket (self, self.origin,
self.movedir * ROCKET_SPEED,
self.proj_basespeed);
}
else if (self.spawnflags & SHOOTER_SPAWNFLAG_VOREBALL)
{
if (!(self.spawnflags & SHOOTER_SPAWNFLAG_SILENT))
sound (self, CHAN_VOICE, "shalrath/attack2.wav",
VOL_HIGH, ATTN_NORM);

spawn_projectile_voreball (self, self.origin,
self.movedir * VOREBALL_SPEED,
self.proj_basespeed);
}
else if (self.spawnflags & SHOOTER_SPAWNFLAG_GRENADE)
{
if (!(self.spawnflags & SHOOTER_SPAWNFLAG_SILENT))
sound (self, CHAN_VOICE, "weapons/grenade.wav",
VOL_HIGH, ATTN_NORM);

local vector gnade_velocity = self.movedir * 600 +
v_up * 200 + crandom() * v_right * 10 +
crandom() * v_up * 10;

spawn_projectile_grenade (self, self.origin,
gnade_velocity);
}
else if (self.spawnflags & SHOOTER_SPAWNFLAG_GIBS)
{
if (!(self.spawnflags & SHOOTER_SPAWNFLAG_SILENT))
sound (self, CHAN_VOICE, "zombie/z_shot1.wav",
VOL_HIGH, ATTN_NORM);

local vector znade_velocity = self.movedir * 600 +
v_up * 200 + crandom() * v_right * 10 +
crandom() * v_up * 10;

spawn_projectile_zombiechunk (self, self.origin,
znade_velocity);
}
else
{
if (!(self.spawnflags & SHOOTER_SPAWNFLAG_SILENT))
// changed vol fromt 1 to 0.666 -- CEV
sound (self, CHAN_VOICE, "weapons/spike2.wav",
VOL_MID, ATTN_NORM);

local float damage;

if (self.spawnflags & SHOOTER_SPAWNFLAG_SUPERSPIKE)
damage = SPIKE_SUPER_DAMAGE;
else
damage = SPIKE_NORMAL_DAMAGE;

// shooter spikes move at half the speed of
// player spikes -- CEV
spawn_projectile_spike (self, self.origin,
self.movedir * 500, damage, 500);
}
};

//--------------------------------------------------------------
void(entity e) base_hazard_shooter_init =
{
base_mapentity_init (e);
e.think = base_hazard_shooter_think;
e.use = base_hazard_shooter_use;

if (e.proj_speed_mod <= 0)
e.proj_speed_mod = 1;

sub_setmovedir (e);

if (e.spawnflags & SHOOTER_SPAWNFLAG_LASER)
{
precache_model2 ("progs/laser.mdl");
precache_sound2 ("enforcer/enfire.wav");
precache_sound2 ("enforcer/enfstop.wav");
}
else if (e.spawnflags & SHOOTER_SPAWNFLAG_LAVABALL)
{
precache_model ("progs/lavaball.mdl");
// precache_sound2 ("knight/sword2.wav"); // dms
precache_sound2 ("boss1/throw.wav"); // dms
}
else if (e.spawnflags & SHOOTER_SPAWNFLAG_ROCKET)
{
precache_model ("progs/missile.mdl");
precache_sound ("weapons/sgun1.wav");
}
else if (e.spawnflags & SHOOTER_SPAWNFLAG_VOREBALL)
{
precache_model ("progs/v_spike.mdl");
precache_sound ("shalrath/attack2.wav");
}
else if (e.spawnflags & SHOOTER_SPAWNFLAG_GRENADE)
{
precache_model ("progs/grenade.mdl");
// grenade launcher
precache_sound ("weapons/grenade.wav");
}
else if (e.spawnflags & SHOOTER_SPAWNFLAG_GIBS)
{
precache_model ("progs/zom_gib.mdl");
// Zombie gibs
precache_sound ("zombie/z_shot1.wav");
precache_sound ("zombie/z_miss.wav");
precache_sound ("zombie/z_hit.wav");
}
else
{
precache_sound ("weapons/spike2.wav");
}
};

//--------------------------------------------------------------
strip void() base_hazard_shooter =
{
base_hazard_shooter_init (self);
};
#endif
// };

/*QUAKED trap_spikeshooter (0 .5 .8) (-8 -8 -8) (8 8 8) superspike laser lavaball rocket silent X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY

When triggered, fires a spike in the direction set in QuakeEd.
Laser is only for REGISTERED.
*/
//----------------------------------------------------------------------
// class trap_spikeshooter: base_hazard_shooter
// {
#ifdef SSQC
//--------------------------------------------------------------
void(entity e) trap_spikeshooter_init =
{
e.classname = "trap_spikeshooter";
e.classtype = CT_HAZARD_SPIKESHOOTER;
base_hazard_shooter_init (e);
};

//--------------------------------------------------------------
void() trap_spikeshooter =
{
// new spawnflags for all entities -- iw
if (SUB_Inhibit())
return;

trap_spikeshooter_init (self);
};
#endif
// };

/*QUAKED trap_shooter (0 .5 .8) (-8 -8 -8) (8 8 8) superspike laser lavaball rocket silent X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
Continuously fires spikes.
"wait" time between spike (1.0 default)
"nextthink" delay before firing first spike, so multiple shooters can be stagered.
*/
//----------------------------------------------------------------------
// class trap_shooter: base_hazard_shooter
// {
#ifdef SSQC
//--------------------------------------------------------------
void(entity e) trap_shooter_init =
{
e.classname = "trap_shooter";
e.classtype = CT_HAZARD_SHOOTER;
base_hazard_shooter_init (e);

if (e.wait == 0)
e.wait = 1;

// MED 11/01/96 added state capability
e.state = 1;
e.nextthink = e.nextthink + e.wait + e.ltime;
};

//--------------------------------------------------------------
void() trap_shooter =
{
// new spawnflags for all entities -- iw
if (SUB_Inhibit())
return;

trap_shooter_init (self);
};
#endif
// };

//MED 11/01/96 added new function
/*QUAKED trap_switched_shooter (0 .5 .8) (-8 -8 -8) (8 8 8) superspike laser lavaball rocket silent X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
Continuously fires spikes.
"wait" time between spike (1.0 default)
"nextthink" delay before firing first spike, so multiple shooters can be stagered.
"state" 0 initially off, 1 initially on. (0 default)
*/
//----------------------------------------------------------------------
// class trap_switched_shooter: base_hazard_shooter
// {
#ifdef SSQC
//--------------------------------------------------------------
// trap_shooter_use -- MED 11/01/96 added new use function
//--------------------------------------------------------------
void() trap_switched_shooter_use =
{
self.state = 1 - self.state;
};

//--------------------------------------------------------------
void(entity e) trap_switched_shooter_init =
{
e.classname = "trap_switched_shooter";
e.classtype = CT_HAZARD_SWITCHED_SHOOTER;
base_hazard_shooter_init (e);
e.use = trap_switched_shooter_use;

if (e.wait == 0)
e.wait = 1;

// MED 11/01/96 added state capability
e.nextthink = e.nextthink + e.wait + e.ltime;
};

//--------------------------------------------------------------
void() trap_switched_shooter =
{
// new spawnflags for all entities -- iw
if (SUB_Inhibit())
return;

trap_switched_shooter_init (self);
};
#endif
// };

Return to the top of this page or return to the overview of this repo.

Log shooter.qc

Return to the top of this page or return to the overview of this repo.