quake-hipnotic-sdk/progs/misc.qc
1997-03-11 00:00:00 +00:00

745 lines
17 KiB
C++

/*quaked info_null (0 0.5 0) (-4 -4 -4) (4 4 4)
used as a positional target for spotlights, etc.
*/
void() info_null =
{
remove(self);
};
/*quaked info_notnull (0 0.5 0) (-4 -4 -4) (4 4 4)
used as a positional target for lightning.
*/
void() info_notnull =
{
};
//============================================================================
float start_off = 1;
void() light_use =
{
if (self.spawnflags & start_off)
{
lightstyle(self.style, "m");
self.spawnflags = self.spawnflags - start_off;
}
else
{
lightstyle(self.style, "a");
self.spawnflags = self.spawnflags + start_off;
}
};
/*quaked light (0 1 0) (-8 -8 -8) (8 8 8) start_off
non-displayed light.
default light value is 300
default style is 0
if targeted, it will toggle between on or off.
*/
void() light =
{
if (!self.targetname)
{ // inert light
remove(self);
return;
}
if (self.style >= 32)
{
self.use = light_use;
if (self.spawnflags & start_off)
lightstyle(self.style, "a");
else
lightstyle(self.style, "m");
}
};
/*quaked light_fluoro (0 1 0) (-8 -8 -8) (8 8 8) start_off
non-displayed light.
default light value is 300
default style is 0
if targeted, it will toggle between on or off.
makes steady fluorescent humming sound
*/
void() light_fluoro =
{
if (self.style >= 32)
{
self.use = light_use;
if (self.spawnflags & start_off)
lightstyle(self.style, "a");
else
lightstyle(self.style, "m");
}
precache_sound ("ambience/fl_hum1.wav");
ambientsound (self.origin, "ambience/fl_hum1.wav", 0.5, attn_static);
};
/*quaked light_fluorospark (0 1 0) (-8 -8 -8) (8 8 8)
non-displayed light.
default light value is 300
default style is 10
makes sparking, broken fluorescent sound
*/
void() light_fluorospark =
{
if (!self.style)
self.style = 10;
precache_sound ("ambience/buzz1.wav");
ambientsound (self.origin, "ambience/buzz1.wav", 0.5, attn_static);
};
/*quaked light_globe (0 1 0) (-8 -8 -8) (8 8 8)
sphere globe light.
default light value is 300
default style is 0
*/
void() light_globe =
{
precache_model ("progs/s_light.spr");
setmodel (self, "progs/s_light.spr");
makestatic (self);
};
void() fireambient =
{
precache_sound ("ambience/fire1.wav");
// attenuate fast
ambientsound (self.origin, "ambience/fire1.wav", 0.5, attn_static);
};
/*quaked light_torch_small_walltorch (0 .5 0) (-10 -10 -20) (10 10 20)
short wall torch
default light value is 200
default style is 0
*/
void() light_torch_small_walltorch =
{
precache_model ("progs/flame.mdl");
setmodel (self, "progs/flame.mdl");
fireambient ();
makestatic (self);
};
/*quaked light_flame_large_yellow (0 1 0) (-10 -10 -12) (12 12 18)
large yellow flame ball
*/
void() light_flame_large_yellow =
{
precache_model ("progs/flame2.mdl");
setmodel (self, "progs/flame2.mdl");
self.frame = 1;
fireambient ();
makestatic (self);
};
/*quaked light_flame_small_yellow (0 1 0) (-8 -8 -8) (8 8 8) start_off
small yellow flame ball
*/
void() light_flame_small_yellow =
{
precache_model ("progs/flame2.mdl");
setmodel (self, "progs/flame2.mdl");
fireambient ();
makestatic (self);
};
/*quaked light_flame_small_white (0 1 0) (-10 -10 -40) (10 10 40) start_off
small white flame ball
*/
void() light_flame_small_white =
{
precache_model ("progs/flame2.mdl");
setmodel (self, "progs/flame2.mdl");
fireambient ();
makestatic (self);
};
//============================================================================
/*quaked misc_fireball (0 .5 .8) (-8 -8 -8) (8 8 8)
lava balls
*/
void() fire_fly;
void() fire_touch;
void() misc_fireball =
{
precache_model ("progs/lavaball.mdl");
self.classname = "fireball";
self.nextthink = time + (random() * 5);
self.think = fire_fly;
if (!self.speed)
self.speed == 1000;
};
void() fire_fly =
{
local entity fireball;
fireball = spawn();
fireball.solid = solid_trigger;
fireball.movetype = movetype_toss;
fireball.velocity = '0 0 1000';
fireball.velocity_x = (random() * 100) - 50;
fireball.velocity_y = (random() * 100) - 50;
fireball.velocity_z = self.speed + (random() * 200);
fireball.classname = "fireball";
setmodel (fireball, "progs/lavaball.mdl");
setsize (fireball, '0 0 0', '0 0 0');
setorigin (fireball, self.origin);
fireball.nextthink = time + 5;
fireball.think = sub_remove;
fireball.touch = fire_touch;
self.nextthink = time + (random() * 5) + 3;
self.think = fire_fly;
};
void() fire_touch =
{
t_damage (other, self, self, 20);
remove(self);
};
//============================================================================
void() barrel_explode =
{
self.takedamage = damage_no;
self.classname = "explo_box";
// did say self.owner
t_radiusdamage (self, self, 160, world);
sound (self, chan_voice, "weapons/r_exp3.wav", 1, attn_norm);
particle (self.origin, '0 0 0', 75, 255);
self.origin_z = self.origin_z + 32;
becomeexplosion ();
};
/*quaked misc_explobox (0 .5 .8) (0 0 0) (32 32 64)
testing thing
*/
void() misc_explobox =
{
local float oldz;
self.solid = solid_bbox;
self.movetype = movetype_none;
precache_model ("maps/b_explob.bsp");
setmodel (self, "maps/b_explob.bsp");
precache_sound ("weapons/r_exp3.wav");
self.health = 20;
self.th_die = barrel_explode;
self.takedamage = damage_aim;
self.origin_z = self.origin_z + 2;
oldz = self.origin_z;
droptofloor();
if (oldz - self.origin_z > 250)
{
dprint ("item fell out of level at ");
dprint (vtos(self.origin));
dprint ("\n");
remove(self);
}
};
/*quaked misc_explobox2 (0 .5 .8) (0 0 0) (32 32 64)
smaller exploding box, registered only
*/
void() misc_explobox2 =
{
local float oldz;
self.solid = solid_bbox;
self.movetype = movetype_none;
precache_model2 ("maps/b_exbox2.bsp");
setmodel (self, "maps/b_exbox2.bsp");
precache_sound ("weapons/r_exp3.wav");
self.health = 20;
self.th_die = barrel_explode;
self.takedamage = damage_aim;
self.origin_z = self.origin_z + 2;
oldz = self.origin_z;
droptofloor();
if (oldz - self.origin_z > 250)
{
dprint ("item fell out of level at ");
dprint (vtos(self.origin));
dprint ("\n");
remove(self);
}
};
//============================================================================
void(vector org, vector vec) launchlaser;
//med 11/09/96 added lava ball and rocket
void() spikeshooter_use =
{
local entity lavaball;
if (self.spawnflags & spawnflag_laser)
{
if (!self.spawnflags & spawnflag_silent)
sound (self, chan_voice, "enforcer/enfire.wav", 1, attn_norm);
launchlaser (self.origin, self.movedir);
newmis.spawnflags = self.spawnflags;
}
else if (self.spawnflags & spawnflag_lavaball)
{
if (!self.spawnflags & spawnflag_silent)
sound (self, chan_voice, "misc/spike.wav", 1, attn_norm);
lavaball = spawn();
lavaball.movetype = movetype_flymissile;
lavaball.solid = solid_bbox;
lavaball.classname = "lavaball";
// set lavaball speed
lavaball.velocity = self.movedir * 300;
lavaball.angles = vectoangles(lavaball.velocity);
lavaball.owner = self;
lavaball.touch = t_missiletouch;
setmodel (lavaball, "progs/lavarock.mdl");
setsize (lavaball, '-4 -4 -4', '4 4 4');
setorigin (lavaball, self.origin);
lavaball.avelocity = '0 0 400';
lavaball.nextthink = time + 5;
lavaball.think = sub_remove;
}
else if (self.spawnflags & spawnflag_rocket)
{
if (!self.spawnflags & spawnflag_silent)
sound (self, chan_voice, "weapons/sgun1.wav", 1, attn_norm);
w_firerocket();
newmis.velocity = self.movedir*1000;
newmis.angles = vectoangles(newmis.velocity);
setorigin (newmis, self.origin + self.movedir*8);
}
else
{
if (!self.spawnflags & spawnflag_silent)
sound (self, chan_voice, "weapons/spike2.wav", 1, attn_norm);
launch_spike (self.origin, self.movedir);
newmis.velocity = self.movedir * 500;
if (self.spawnflags & spawnflag_superspike)
newmis.touch = superspike_touch;
}
};
//med 11/01/96 added state capability
void() shooter_think =
{
if (self.state)
{
spikeshooter_use ();
}
self.nextthink = time + self.wait;
};
/*quaked trap_spikeshooter (0 .5 .8) (-8 -8 -8) (8 8 8) superspike laser lavaball rocket silent
when triggered, fires a spike in the direction set in quakeed.
laser is only for registered.
*/
//med 11/01/96 commented out setmovedir
void() trap_spikeshooter =
{
setmovedir ();
self.use = spikeshooter_use;
if (self.spawnflags & spawnflag_laser)
{
precache_model2 ("progs/laser.mdl");
precache_sound2 ("enforcer/enfire.wav");
precache_sound2 ("enforcer/enfstop.wav");
}
else if (self.spawnflags & spawnflag_lavaball)
{
precache_model ("progs/lavarock.mdl");
// self.classname = "fireball";
precache_sound2 ("misc/spike.wav");
}
else if (self.spawnflags & spawnflag_rocket)
{
precache_model ("progs/missile.mdl");
precache_sound ("weapons/sgun1.wav");
}
else
precache_sound ("weapons/spike2.wav");
};
/*quaked trap_shooter (0 .5 .8) (-8 -8 -8) (8 8 8) superspike laser lavaball rocket silent
continuously fires spikes.
"wait" time between spike (1.0 default)
"nextthink" delay before firing first spike, so multiple shooters can be stagered.
*/
void() trap_shooter =
{
trap_spikeshooter ();
if (self.wait == 0)
self.wait = 1;
//med 11/01/96 added state capability
self.state = 1;
self.nextthink = self.nextthink + self.wait + self.ltime;
self.think = shooter_think;
};
//med 11/01/96 added new use function
void() trap_shooter_use =
{
self.state = 1 - self.state;
};
//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
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)
*/
void() trap_switched_shooter =
{
trap_spikeshooter ();
if (self.wait == 0)
self.wait = 1;
//med 11/01/96 added state capability
self.nextthink = self.nextthink + self.wait + self.ltime;
self.think = shooter_think;
self.use = trap_shooter_use;
};
/*
===============================================================================
===============================================================================
*/
void() make_bubbles;
void() bubble_remove;
void() bubble_bob;
/*quaked air_bubbles (0 .5 .8) (-8 -8 -8) (8 8 8)
testing air bubbles
*/
void() air_bubbles =
{
if (deathmatch)
{
remove (self);
return;
}
precache_model ("progs/s_bubble.spr");
self.nextthink = time + 1;
self.think = make_bubbles;
};
void() make_bubbles =
{
local entity bubble;
bubble = spawn();
setmodel (bubble, "progs/s_bubble.spr");
setorigin (bubble, self.origin);
bubble.movetype = movetype_noclip;
bubble.solid = solid_not;
bubble.velocity = '0 0 15';
bubble.nextthink = time + 0.5;
bubble.think = bubble_bob;
bubble.touch = bubble_remove;
bubble.classname = "bubble";
bubble.frame = 0;
bubble.cnt = 0;
setsize (bubble, '-8 -8 -8', '8 8 8');
self.nextthink = time + random() + 0.5;
self.think = make_bubbles;
};
void() bubble_split =
{
local entity bubble;
bubble = spawn();
setmodel (bubble, "progs/s_bubble.spr");
setorigin (bubble, self.origin);
bubble.movetype = movetype_noclip;
bubble.solid = solid_not;
bubble.velocity = self.velocity;
bubble.nextthink = time + 0.5;
bubble.think = bubble_bob;
bubble.touch = bubble_remove;
bubble.classname = "bubble";
bubble.frame = 1;
bubble.cnt = 10;
setsize (bubble, '-8 -8 -8', '8 8 8');
self.frame = 1;
self.cnt = 10;
if (self.waterlevel != 3)
remove (self);
};
void() bubble_remove =
{
if (other.classname == self.classname)
{
// dprint ("bump");
return;
}
remove(self);
};
void() bubble_bob =
{
local float rnd1, rnd2, rnd3;
local vector vtmp1, modi;
self.cnt = self.cnt + 1;
if (self.cnt == 4)
bubble_split();
if (self.cnt == 20)
remove(self);
rnd1 = self.velocity_x + (-10 + (random() * 20));
rnd2 = self.velocity_y + (-10 + (random() * 20));
rnd3 = self.velocity_z + 10 + random() * 10;
if (rnd1 > 10)
rnd1 = 5;
if (rnd1 < -10)
rnd1 = -5;
if (rnd2 > 10)
rnd2 = 5;
if (rnd2 < -10)
rnd2 = -5;
if (rnd3 < 10)
rnd3 = 15;
if (rnd3 > 30)
rnd3 = 25;
self.velocity_x = rnd1;
self.velocity_y = rnd2;
self.velocity_z = rnd3;
self.nextthink = time + 0.5;
self.think = bubble_bob;
};
/*~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>
~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~*/
/*quaked viewthing (0 .5 .8) (-8 -8 -8) (8 8 8)
just for the debugging level. don't use
*/
void() viewthing =
{
self.movetype = movetype_none;
self.solid = solid_not;
precache_model ("progs/player.mdl");
setmodel (self, "progs/player.mdl");
};
/*
==============================================================================
simple bmodels
==============================================================================
*/
void() func_wall_use =
{ // change to alternate textures
self.frame = 1 - self.frame;
};
/*quaked func_wall (0 .5 .8) ?
this is just a solid wall if not inhibitted
*/
void() func_wall =
{
self.angles = '0 0 0';
self.movetype = movetype_push; // so it doesn't get pushed by anything
self.solid = solid_bsp;
self.use = func_wall_use;
setmodel (self, self.model);
};
/*quaked func_illusionary (0 .5 .8) ?
a simple entity that looks solid but lets you walk through it.
*/
void() func_illusionary =
{
self.angles = '0 0 0';
self.movetype = movetype_none;
self.solid = solid_not;
setmodel (self, self.model);
makestatic ();
};
/*quaked func_episodegate (0 .5 .8) ? e1 e2 e3 e4
this bmodel will appear if the episode has allready been completed, so players can't reenter it.
*/
void() func_episodegate =
{
if (!(serverflags & self.spawnflags))
return; // can still enter episode
self.angles = '0 0 0';
self.movetype = movetype_push; // so it doesn't get pushed by anything
self.solid = solid_bsp;
self.use = func_wall_use;
setmodel (self, self.model);
};
/*quaked func_bossgate (0 .5 .8) ?
this bmodel appears unless players have all of the episode sigils.
*/
void() func_bossgate =
{
if ( (serverflags & 15) == 15)
return; // all episodes completed
self.angles = '0 0 0';
self.movetype = movetype_push; // so it doesn't get pushed by anything
self.solid = solid_bsp;
self.use = func_wall_use;
setmodel (self, self.model);
};
//============================================================================
/*quaked ambient_suck_wind (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
*/
void() ambient_suck_wind =
{
precache_sound ("ambience/suck1.wav");
ambientsound (self.origin, "ambience/suck1.wav", 1, attn_static);
};
/*quaked ambient_drone (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
*/
void() ambient_drone =
{
precache_sound ("ambience/drone6.wav");
ambientsound (self.origin, "ambience/drone6.wav", 0.5, attn_static);
};
/*quaked ambient_flouro_buzz (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
*/
void() ambient_flouro_buzz =
{
precache_sound ("ambience/buzz1.wav");
ambientsound (self.origin, "ambience/buzz1.wav", 1, attn_static);
};
/*quaked ambient_drip (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
*/
void() ambient_drip =
{
precache_sound ("ambience/drip1.wav");
ambientsound (self.origin, "ambience/drip1.wav", 0.5, attn_static);
};
/*quaked ambient_comp_hum (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
*/
void() ambient_comp_hum =
{
precache_sound ("ambience/comp1.wav");
ambientsound (self.origin, "ambience/comp1.wav", 1, attn_static);
};
/*quaked ambient_thunder (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
*/
void() ambient_thunder =
{
precache_sound ("ambience/thunder1.wav");
ambientsound (self.origin, "ambience/thunder1.wav", 0.5, attn_static);
};
/*quaked ambient_light_buzz (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
*/
void() ambient_light_buzz =
{
precache_sound ("ambience/fl_hum1.wav");
ambientsound (self.origin, "ambience/fl_hum1.wav", 0.5, attn_static);
};
/*quaked ambient_swamp1 (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
*/
void() ambient_swamp1 =
{
precache_sound ("ambience/swamp1.wav");
ambientsound (self.origin, "ambience/swamp1.wav", 0.5, attn_static);
};
/*quaked ambient_swamp2 (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
*/
void() ambient_swamp2 =
{
precache_sound ("ambience/swamp2.wav");
ambientsound (self.origin, "ambience/swamp2.wav", 0.5, attn_static);
};
//============================================================================
void() noise_think =
{
self.nextthink = time + 0.5;
sound (self, 1, "enforcer/enfire.wav", 1, attn_norm);
sound (self, 2, "enforcer/enfstop.wav", 1, attn_norm);
sound (self, 3, "enforcer/sight1.wav", 1, attn_norm);
sound (self, 4, "enforcer/sight2.wav", 1, attn_norm);
sound (self, 5, "enforcer/sight3.wav", 1, attn_norm);
sound (self, 6, "enforcer/sight4.wav", 1, attn_norm);
sound (self, 7, "enforcer/pain1.wav", 1, attn_norm);
};
/*quaked misc_noisemaker (1 0.5 0) (-10 -10 -10) (10 10 10)
for optimzation testing, starts a lot of sounds.
*/
void() misc_noisemaker =
{
precache_sound2 ("enforcer/enfire.wav");
precache_sound2 ("enforcer/enfstop.wav");
precache_sound2 ("enforcer/sight1.wav");
precache_sound2 ("enforcer/sight2.wav");
precache_sound2 ("enforcer/sight3.wav");
precache_sound2 ("enforcer/sight4.wav");
precache_sound2 ("enforcer/pain1.wav");
precache_sound2 ("enforcer/pain2.wav");
precache_sound2 ("enforcer/death1.wav");
precache_sound2 ("enforcer/idle1.wav");
self.nextthink = time + 0.1 + random();
self.think = noise_think;
};