djcev.com

//

Git Repos / fte_dogmode / qc / misc / play.qc

Last update to this file was on 2024-04-12 at 18:56.

Show play.qc

//==============================================================================
// a collection of various pieces of mods and some new code -- dumptruck_ds
//==============================================================================

//======================================================================
// Miscelanneous QuickC program
// Copyright (c)1996 Hipnotic Interactive, Inc.
// All rights reserved.
// Distributed (unsupported) on 3.12.97
//======================================================================

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

// base_play_sound
void() base_play_sound_think;
void() base_play_sound_use;
void(entity e) base_play_sound_init;
strip void() base_play_sound;

// play_sound_triggered
void(entity e) play_sound_triggered_init;
void() play_sound_triggered;

// play_sound
void(entity e) play_sound_init;
void() play_sound;

// base_tele_fog
void() base_tele_fog_use;
void(entity e) base_tele_fog_init;

// tele_fog
void(entity e) tele_fog_init;
void() tele_fog;

// play_tele
void(entity e) play_tele_init;
void() play_tele;

// play_explosion
void() play_explosion_use;
void(entity e) play_explosion_init;
void() play_explosion;

// play_lavasplash
void() play_lavasplash_use;
void(entity e) play_lavasplash_init;
void() play_lavasplash;

// base_meat_shower
void() base_meat_shower_use;
void(entity e) base_meat_shower_init;

// meat_shower
void(entity e) meat_shower_init;
void() meat_shower;

// play_gibs
void(entity e) play_gibs_init;
void() play_gibs;

// play_mflash
void() play_mflash_use;
void(entity e) play_mflash_init;
void() play_mflash;

// play_bfield
void() play_bfield_use
void(entity e) play_bfield_init;
void() play_bfield;

// play_brlight
void() play_brlight_use;
void(entity e) play_brlight_init;
void() play_brlight;

// play_dimlight
void() play_dimlight_use;
void(entity e) play_dimlight_init;
void() play_dimlight;

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

//----------------------------------------------------------------------
// class base_play_sound: base_mapentity
// {
//--------------------------------------------------------------
// was PlaySoundThink -- CEV
//--------------------------------------------------------------
void() base_play_sound_think =
{
local float t;
t = self.wait * random ();

if (t < self.delay)
t = self.delay;

self.nextthink = time + t;
base_play_sound_use ();
};

//--------------------------------------------------------------
// was play_sound_use -- CEV
//--------------------------------------------------------------
void() base_play_sound_use =
{
if (self.spawnflags & 1)
{
if (self.state == 0)
{
self.state = 1;
sound (self, self.impulse, self.noise,
self.volume, self.speed);
}
else
{
self.state = 0;
sound (self, self.impulse, "misc/null.wav",
self.volume, self.speed);
}
}
else
{
sound (self, self.impulse, self.noise,
self.volume, self.speed);
}
};

//--------------------------------------------------------------
// was play_sound_triggered -- CEV
//--------------------------------------------------------------
void(entity e) base_play_sound_init =
{
base_mapentity_init (e);

precache_sound (e.noise);
precache_sound ("misc/null.wav");
if (e.volume == 0)
e.volume = 1;
if (e.speed == 0)
e.speed = 1;
if (e.speed == -1)
// e.speed = 0;
e.speed = ATTN_NONE;
if (e.spawnflags & 1)
if (e.impulse == 0)
e.impulse = 7;

e.use = base_play_sound_use;
};

//--------------------------------------------------------------
strip void() base_play_sound =
{
base_play_sound_init (self);
};
// };

/*QUAKED play_sound_triggered (0.3 0.1 0.6) (-8 -8 -8) (8 8 8) toggle
play a sound when it is used
"toggle" determines whether sound should be stopped when triggered again
"volume" how loud (1 default full volume)
"noise" sound to play
"impulse" channel on which to play sound (0-7) (0 automatic is default)
"speed" attenuation factor
-1 - no attenuation
1 - normal
2 - idle
3 - static
*/
//----------------------------------------------------------------------
// class play_sound_triggered: base_play_sound
// {
//--------------------------------------------------------------
void(entity e) play_sound_triggered_init =
{
e.classname = "play_sound_triggered";
e.classtype = CT_MISC_PLAY_SOUND_TRIGGERED;

// dumptruck_ds
if (!e.noise)
{
objerror ("no soundfile set in noise!\n");
remove (e);
return;
}

base_play_sound_init (e);
};

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

play_sound_triggered_init (self);
};
// };

/*QUAKED play_sound (0.3 0.1 0.6) (-8 -8 -8) (8 8 8)
play a sound on a periodic basis
"volume" how loud (1 default full volume)
"noise" sound to play
"wait" random time between sounds (default 20)
"delay" minimum delay between sounds (default 2)
"impulse" channel on which to play sound (0-7) (0 automatic is default)
"speed" attenuation factor
-1 - no attenuation
1 - normal
2 - idle
3 - static
*/
//----------------------------------------------------------------------
// class play_sound: base_play_sound
// {
//--------------------------------------------------------------
void(entity e) play_sound_init =
{
e.classname = "play_sound";
e.classtype = CT_MISC_PLAY_SOUND;

// dumptruck_ds
if (!e.noise)
{
objerror ("no soundfile set in noise!\n");
remove (e);
return;
}

base_play_sound_init (e);

if (e.wait == 0)
e.wait = 20;
if (e.delay == 0)
e.delay = 2;

local float t = e.wait * random ();
if (t < e.delay)
t = e.delay;

e.think = base_play_sound_think;
e.nextthink = time + t;
};

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

play_sound_init (self);
};
// };

//----------------------------------------------------------------------
// class base_tele_fog: base_mapentity
// {
//--------------------------------------------------------------
void() base_tele_fog_use =
{
// thanks Khreathor -- dumptruck_ds
spawn_tfog (self.origin);
};

//--------------------------------------------------------------
void(entity e) base_tele_fog_init =
{
base_mapentity_init (e);
e.use = base_tele_fog_use;
};
// };

/*QUAKED tele_fog (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)

When triggered, tele_fog shows the teleport particle effects and sounds.

Use this when killtageting an entity if the player can see.

*/
//----------------------------------------------------------------------
// class tele_fog: base_tele_fog
// {
//--------------------------------------------------------------
void(entity e) tele_fog_init =
{
e.classname = "tele_fog";
e.classtype = CT_MISC_TELE_FOG;

base_tele_fog_init (e);
};

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

tele_fog_init (self);
};
// };

/*QUAKED play_tele (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)

When triggered, tele_fog shows the teleport particle effects and sounds.
Same os tele_fog.

Use this when killtageting an entity if the player can see.

*/
//----------------------------------------------------------------------
// class play_tele: base_tele_fog
// {
//--------------------------------------------------------------
void(entity e) play_tele_init =
{
// same as tele_fog, added for "play_xxxx" consistancy
e.classname = "tele_fog";
// use same classtype as tele_fog () -- CEV
e.classtype = CT_MISC_TELE_FOG;

base_tele_fog_init (e);
};

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

play_tele_init (self);
};
// };

/*QUAKED play_explosion (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)

When triggered, creates a explosion at it's origin. Causes damage.

*/
//----------------------------------------------------------------------
// class play_explosion: base_mapentity
// {
//--------------------------------------------------------------
// was play_explosion_fx -- CEV
//--------------------------------------------------------------
void() play_explosion_use =
{
// thanks Khreathor -- dumptruck_ds
t_radiusdamage2 (self, self, 120, world);
write_explosion (self.origin);
spawn_base_explosion (self.origin);
remove (self);
};

//--------------------------------------------------------------
void(entity e) play_explosion_init =
{
e.classname = "play_explosion";
e.classtype = CT_MISC_PLAY_EXPLOSION;

base_mapentity_init (e);

e.use = play_explosion_use;
};

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

play_explosion_init (self);
};
// };

/*QUAKED play_lavasplash (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)

When triggered, plays the lavasplash effect from E1M7.

Use noise key for a custom sound.

*/
//----------------------------------------------------------------------
// class play_lavasplash: base_mapentity
// {
//--------------------------------------------------------------
void() play_lavasplash_use =
{
// thanks Khreathor -- dumptruck_ds
if (self.noise != "")
sound (self, CHAN_AUTO, self.noise, 1, ATTN_NORM);
else
sound (self, CHAN_AUTO, "boss1/out1.wav", 1, ATTN_NORM);

WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
WriteByte (MSG_BROADCAST, TE_LAVASPLASH);
WriteCoord (MSG_BROADCAST, self.origin_x);
WriteCoord (MSG_BROADCAST, self.origin_y);
WriteCoord (MSG_BROADCAST, self.origin_z);
};

//--------------------------------------------------------------
void(entity e) play_lavasplash_init =
{
e.classname = "play_lavasplash";
e.classtype = CT_MISC_PLAY_LAVASPLASH;

base_mapentity_init (e);

if (e.noise != "")
precache_sound (e.noise);

precache_sound("boss1/out1.wav");

e.use = play_lavasplash_use;
};

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

play_lavasplash_init (self);
};
// };

//----------------------------------------------------------------------
// class base_meat_shower: base_mapentity
// {
//--------------------------------------------------------------
void() base_meat_shower_use =
{
// -- dumptruck_ds -- thanks to Spike for helping with errors
if (self.style == 1)
{
throw_gib_1 (self, '0 0 0', random() * -80);
throw_gib_2 (self, '0 0 0', random() * -80);
throw_gib_3 (self, '0 0 0', random() * -80);
throw_gib_1 (self, '0 0 0', random() * -75);
throw_gib_2 (self, '0 0 0', random() * -75);
throw_gib_3 (self, '0 0 0', random() * -75);
}
else
{
throw_gib_1 (self, '0 0 0', random() * -65);
throw_gib_2 (self, '0 0 0', random() * -65);
throw_gib_3 (self, '0 0 0', random() * -65);
}

if (self.fly_sound != 1)
return;

if (random() < 0.5)
sound (self, CHAN_VOICE, "player/gib.wav",
1, ATTN_NORM);
else
sound (self, CHAN_VOICE, "player/udeath.wav",
1, ATTN_NORM);
};

//--------------------------------------------------------------
void(entity e) base_meat_shower_init =
{
base_mapentity_init (e);
e.use = base_meat_shower_use;
};
// };

/*QUAKED meat_shower (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)

When triggered, plays a gib effect.

Use style 0 for normal and 1 for extra large. fly_sound 0 is silent, 1 for regular gib sounds.

*/
//----------------------------------------------------------------------
// class meat_shower: base_meat_shower
// {
//--------------------------------------------------------------
void(entity e) meat_shower_init =
{
e.classname = "meat_shower";
e.classtype = CT_MISC_PLAY_GIBS;

base_meat_shower_init (e);
};

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

meat_shower_init (self);
};
// };

/*QUAKED play_gibs (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)

When triggered, plays a gib effect. Same as meat_shower.

Use style 0 for normal and 1 for extra large. fly_sound 0 is silent, 1 for regular gib sounds.

*/
//----------------------------------------------------------------------
// class play_gibs: base_meat_shower
// {
//--------------------------------------------------------------
void(entity e) play_gibs_init =
{
// same as meat_shower, added for "play_xxxx" consistancy
e.classname = "play_gibs";
e.classtype = CT_MISC_PLAY_GIBS;

base_meat_shower_init (e);
};

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

play_gibs_init (self);
};
// };

/*QUAKED play_mflash (0 .5 .8) (-8 -8 -8) (8 8 8)
triggable muzzle flash effect entity
*/
//----------------------------------------------------------------------
// class play_mflash: base_mapentity
// {
//--------------------------------------------------------------
void() play_mflash_use =
{
self.effects = self.effects | EF_MUZZLEFLASH;

if (self.noise != "")
sound (self, CHAN_AUTO, self.noise, 1, ATTN_NORM);
};

//--------------------------------------------------------------
void(entity e) play_mflash_init =
{
e.classname = "play_mflash";
e.classtype = CT_MISC_PLAY_MFLASH;

base_mapentity_init (e);

precache_model ("progs/s_null.spr");
if (e.noise != "")
precache_sound (e.noise);

setmodel (e, "progs/s_null.spr");
setorigin (e, e.origin);
e.movetype = MOVETYPE_NONE;
e.solid = SOLID_NOT;
setsize (e, '0 0 0', '0 0 0');

e.use = play_mflash_use;
};

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

play_mflash_init (self);
};
// };

/*QUAKED play_bfield (0 .5 .8) (-8 -8 -8) (8 8 8)
a triggerable, spherical field of yellow particles
state 1 = start on
*/
//----------------------------------------------------------------------
// class play_bfield: base_mapentity
// {
//--------------------------------------------------------------
void() play_bfield_use =
{
if (!self.state)
{
self.state = 1;
self.effects = self.effects | EF_BRIGHTFIELD;
sound (self, CHAN_AUTO, self.noise, 1, ATTN_NORM);
}
else
{
self.state = 0;
self.effects = self.effects -
(self.effects & EF_BRIGHTFIELD);
sound (self, CHAN_AUTO, self.noise, 1, ATTN_NORM);
}
};

//--------------------------------------------------------------
void(entity e) play_bfield_init =
{
e.classname = "play_bfield";
e.classtype = CT_MISC_PLAY_BFIELD;

base_mapentity_init (e);

precache_model ("progs/s_null.spr");
if (e.noise != "")
precache_sound (e.noise);

setmodel (e, "progs/s_null.spr");
setorigin (e, e.origin);
e.movetype = MOVETYPE_NONE;
e.solid = SOLID_NOT;
setsize (e, '0 0 0', '0 0 0');
if (e.state)
e.effects = e.effects | EF_BRIGHTFIELD;

e.use = play_bfield_use;
};

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

play_bfield_init (self);
};
// };

/*QUAKED play_brlight (0 .5 .8) (-8 -8 -8) (8 8 8)
a triggerable bright lighting effect
state 1 = start on
*/
//----------------------------------------------------------------------
// class play_brlight: base_mapentity
// {
//--------------------------------------------------------------
void() play_brlight_use =
{
// dumptruck_ds -- thanks to c0burn
if (!self.state)
{
self.state = 1;
self.effects = self.effects | EF_BRIGHTLIGHT;
sound (self, CHAN_AUTO, self.noise, 1, ATTN_NORM);
}
else
{
self.state = 0;
self.effects = self.effects -
(self.effects & EF_BRIGHTLIGHT);
sound (self, CHAN_AUTO, self.noise, 1, ATTN_NORM);
}
};

//--------------------------------------------------------------
void(entity e) play_brlight_init =
{
e.classname = "play_brlight";
e.classtype = CT_MISC_PLAY_BRLIGHT;

base_mapentity_init (e);

precache_model ("progs/s_null.spr");
if (e.noise != "")
precache_sound (e.noise);

setmodel (e, "progs/s_null.spr");
setorigin (e, e.origin);
e.movetype = MOVETYPE_NONE;
e.solid = SOLID_NOT;
setsize (e, '0 0 0', '0 0 0');
if (e.state)
e.effects = e.effects | EF_BRIGHTLIGHT;

e.use = play_brlight_use;
};

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

play_brlight_init (self);
};
// };

/*QUAKED play_dimlight (0 .5 .8) (-8 -8 -8) (8 8 8)
a triggerable lighting effect
state 1 = start on
*/
//----------------------------------------------------------------------
// class play_dimlight: base_mapentity
// {
//--------------------------------------------------------------
void() play_dimlight_use =
{
if (!self.state)
{
self.state = 1;
self.effects = self.effects | EF_DIMLIGHT;
sound (self, CHAN_AUTO, self.noise, 1, ATTN_NORM);
}
else
{
self.state = 0;
self.effects = self.effects -
(self.effects & EF_DIMLIGHT);
sound (self, CHAN_AUTO, self.noise, 1, ATTN_NORM);
}
};

//--------------------------------------------------------------
void(entity e) play_dimlight_init =
{
e.classname = "play_dimlight";
e.classtype = CT_MISC_PLAY_DIMLIGHT;

base_mapentity_init (e);

precache_model ("progs/s_null.spr");
if (e.noise != "")
precache_sound (e.noise);

setmodel (e, "progs/s_null.spr");
// setorigin (e, e.origin);
e.movetype = MOVETYPE_NONE;
e.solid = SOLID_NOT;
setsize (e, '0 0 0', '0 0 0');
if (e.state)
e.effects = e.effects | EF_DIMLIGHT;
setorigin (e, e.origin);

e.use = play_dimlight_use;
};

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

play_dimlight_init (self);
};
// };

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

Log play.qc

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