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

84 lines
1.6 KiB
C++

/* earthquake quickc program
by jim dose' 9/13/96
copyright (c)1996 hipnotic interactive, inc.
all rights reserved.
do not distribute.
*/
//jim
float earthquake;
float quakeactive;
void() stopearthquake =
{
earthquake = 0;
};
void( float value ) earthquaketime =
{
value = value + time;
if ( value > earthquake )
{
earthquake = value;
}
};
void() earthquake_prethink =
{
// if ( lastearthquake )
// {
// self.view_ofs_z = self.savedz;
// lastearthquake = 0;
// }
};
void() earthquake_postthink =
{
if ( earthquake > time )
{
if (quakeactive == 0)
{
sound (self, chan_voice, "misc/quake.wav", 1, attn_none);
quakeactive = 1;
}
// lastearthquake = 1;
// self.savedz = self.view_ofs_z;
if ( self.flags & fl_onground )
{
// self.view_ofs_z = self.view_ofs_z - 5 + random() * 10;
self.velocity = self.velocity + (random() * '0 0 150');
}
}
else
{
if (quakeactive == 1)
{
sound (self, chan_voice, "misc/quakeend.wav", 1, attn_none);
quakeactive = 0;
}
}
};
void() earthquake_use =
{
earthquaketime( self.dmg );
};
/*quaked func_earthquake (0 0 0.5) (0 0 0) (32 32 32)
causes an earthquake. triggers targets.
"dmg" is the duration of the earthquake. default is 0.8 seconds.
*/
void() func_earthquake =
{
quakeactive = 0;
precache_sound("misc/quake.wav");
precache_sound("misc/quakeend.wav");
self.classname = "earthquake";
self.use = earthquake_use;
self.think = sub_null;
if ( !self.dmg )
{
self.dmg = 0.8;
}
};