djcev.com

//

Git Repos / fte_dogmode / qc / misc / ambient_sound.qc

Last update to this file was on 2024-06-15 at 19:50.

Show ambient_sound.qc

//==============================================================================
// ambient_sound -- miscellaneous ambient sound entities
//==============================================================================

//======================================================================
// Constants
//======================================================================

#ifdef SSQC
const string SND_AMBIENTCOMPHUM = "ambience/comp1.wav";
const string SND_AMBIENTDRIP = "ambience/drip1.wav";
const string SND_AMBIENTDRONE = "ambience/drone6.wav";
const string SND_AMBIENTFIRE = "ambience/fire1.wav";
const string SND_AMBIENTFBUZZ = "ambience/buzz1.wav";
const string SND_AMBIENTLBUZZ = "ambience/fl_hum1.wav";
const string SND_AMBIENTSWIND = "ambience/suck1.wav";
const string SND_AMBIENTSWAMP1 = "ambience/swamp1.wav";
const string SND_AMBIENTSWAMP2 = "ambience/swamp2.wav";
const string SND_AMBIENTWATER1 = "ambience/water1.wav";
const string SND_AMBIENTWIND2 = "ambience/wind2.wav";
const string SND_AMBIENTHUNDER = "ambience/thunder1.wav";
#endif

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

#ifdef SSQC
// base_ambient_sound
void(vector source) ambient_sound_comphum;
void(vector source) ambient_sound_drip;
void(vector source) ambient_sound_drone;
void(vector source) ambient_sound_fbuzz;
void(vector source) ambient_sound_fire;
void(vector source) ambient_sound_lbuzz;
void(vector source) ambient_sound_suckwind;
void(vector source) ambient_sound_swamp1;
void(vector source) ambient_sound_swamp2;
void(vector source) ambient_sound_water1;
void(vector source) ambient_sound_wind2;
void(entity e) base_ambient_sound_init;
strip void() base_ambient_sound;

// ambient_general
void(entity e) ambient_general_init
void() ambient_general;

// FireAmbient
void(entity e) FireAmbient_init;
void() FireAmbient;

// ambient_fire
void(entity e) ambient_fire_init;
void() ambient_fire;

// ambient_comp_hum
void(entity e) ambient_comp_hum_init;
void() ambient_comp_hum;

// ambient_drip
void(entity e) ambient_drip_init;
void() ambient_drip;

// ambient_drone
void(entity e) ambient_drone_init;
void() ambient_drone;

// ambient_flouro_buzz
void(entity e) ambient_flouro_buzz_init;
void() ambient_flouro_buzz;

// ambient_light_buzz
void(entity e) ambient_light_buzz_init;
void() ambient_light_buzz;

// ambient_suck_wind
void(entity e) ambient_suck_wind_init;
void() ambient_suck_wind;

// ambient_swamp1
void(entity e) ambient_swamp1_init;
void() ambient_swamp1;

// ambient_swamp2
void(entity e) ambient_swamp2_init;
void() ambient_swamp2;

// ambient_water1
void(entity e) ambient_water1_init;
void() ambient_water1;

// ambient_wind2
void(entity e) ambient_wind2_init;
void() ambient_wind2;

// ambient_thunder
void() ambient_thunder_think;
void(entity e) ambient_thunder_init;
void() ambient_thunder;
#endif

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

#ifdef SSQC
//----------------------------------------------------------------------
// class base_ambient_sound: base_mapentity
// {
//--------------------------------------------------------------
void(vector source) ambient_sound_comphum =
{
precache_sound (SND_AMBIENTCOMPHUM);
ambientsound (source, SND_AMBIENTCOMPHUM,
VOL_HIGH, ATTN_STATIC);
};

//--------------------------------------------------------------
void(vector source) ambient_sound_drip =
{
precache_sound (SND_AMBIENTDRIP);
ambientsound (source, SND_AMBIENTDRIP, VOL_MID, ATTN_STATIC);
};

//--------------------------------------------------------------
void(vector source) ambient_sound_drone =
{
precache_sound (SND_AMBIENTDRONE);
ambientsound (source, SND_AMBIENTDRONE, VOL_MID, ATTN_STATIC);
};

//--------------------------------------------------------------
void(vector source) ambient_sound_fbuzz =
{
precache_sound (SND_AMBIENTFBUZZ);
ambientsound (source, SND_AMBIENTFBUZZ, VOL_HIGH, ATTN_STATIC);
};

//--------------------------------------------------------------
void(vector source) ambient_sound_fire =
{
precache_sound (SND_AMBIENTFIRE);
// attenuate fast
ambientsound (source, SND_AMBIENTFIRE, VOL_MID, ATTN_STATIC);
};

//--------------------------------------------------------------
void(vector source) ambient_sound_lbuzz =
{
precache_sound (SND_AMBIENTLBUZZ);
ambientsound (source, SND_AMBIENTLBUZZ, VOL_MID, ATTN_STATIC);
};

//--------------------------------------------------------------
void(vector source) ambient_sound_suckwind =
{
precache_sound (SND_AMBIENTSWIND);
ambientsound (source, SND_AMBIENTSWIND, VOL_HIGH, ATTN_STATIC);
};

//--------------------------------------------------------------
void(vector source) ambient_sound_swamp1 =
{
precache_sound (SND_AMBIENTSWAMP1);
ambientsound (source, SND_AMBIENTSWAMP1, VOL_MID, ATTN_STATIC);
};

//--------------------------------------------------------------
void(vector source) ambient_sound_swamp2 =
{
precache_sound (SND_AMBIENTSWAMP1);
ambientsound (source, SND_AMBIENTSWAMP2, VOL_MID, ATTN_STATIC);
};

//--------------------------------------------------------------
void(vector source) ambient_sound_water1 =
{
precache_sound (SND_AMBIENTWATER1);
ambientsound (source, SND_AMBIENTWATER1, VOL_HIGH, ATTN_STATIC);
};

//--------------------------------------------------------------
void(vector source) ambient_sound_wind2 =
{
precache_sound (SND_AMBIENTWIND2);
ambientsound (source, SND_AMBIENTWIND2, VOL_HIGH, ATTN_STATIC);
};

//--------------------------------------------------------------
void(entity e) base_ambient_sound_init =
{
base_mapentity_init (e);
};

//--------------------------------------------------------------
strip void() base_ambient_sound =
{
base_ambient_sound_init (self);
};
// };

//======================================================================
// johnfitz -- ambient_general (this is from Rubicon Rumble dev kit)
//======================================================================

/*QUAKED ambient_general (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) X X X X X 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
Plays any looped sound

Keys:

"noise" is the wav file to play

"volume" default 1

"speed" attenuation, default 3
*/
//----------------------------------------------------------------------
// class ambient_general: base_mapentity
// {
//--------------------------------------------------------------
void(entity e) ambient_general_init =
{
e.classname = "ambient_general";
e.classtype = CT_MISC_AMBIENT_GENERAL;

base_mapentity_init (e);

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

precache_sound (e.noise);

if (!e.speed)
e.speed = ATTN_NORM;
if (e.speed == 0)
e.speed = 1;
if (e.speed == -1)
// e.speed = 0;
e.speed = ATTN_NONE;

if (!e.volume)
e.volume = 0.5;

ambientsound (e.origin, e.noise, e.volume, e.speed);
remove (e);
};

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

ambient_general_init (self);
};
// };

/*QUAKED FireAmbient (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
*/
//----------------------------------------------------------------------
// class FireAmbient: base_ambient_sound
// {
//--------------------------------------------------------------
void(entity e) FireAmbient_init =
{
e.classname = "FireAmbient";
e.classtype = CT_MISC_AMBIENT_FIRE;

base_ambient_sound_init (e);

ambient_sound_fire (e.origin);
};

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

FireAmbient_init (self);
};
// };

/*QUAKED ambient_fire (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) X X X X X 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
ambinet fire sound effects added for consistency
same as FireAmbient
*/
//----------------------------------------------------------------------
// class ambient_fire: base_ambient_sound
// {
//--------------------------------------------------------------
void(entity e) ambient_fire_init =
{
e.classname = "ambient_fire";
e.classtype = CT_MISC_AMBIENT_FIRE;

base_ambient_sound_init (e);

ambient_sound_fire (e.origin);
};

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

ambient_fire_init (self);
};
// };

/*QUAKED ambient_comp_hum (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) X X X X X 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
*/
//----------------------------------------------------------------------
// class ambient_comp_hum: base_ambient_sound
// {
//--------------------------------------------------------------
void(entity e) ambient_comp_hum_init =
{
e.classname = "ambient_comp_hum";
e.classtype = CT_MISC_AMBIENT_COMPHUM;

base_ambient_sound_init (e);

ambient_sound_comphum (e.origin);
};

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

ambient_comp_hum_init (self);
};
// };

/*QUAKED ambient_drip (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) X X X X X 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
*/
//----------------------------------------------------------------------
// class ambient_drip: base_ambient_sound
// {
//--------------------------------------------------------------
void(entity e) ambient_drip_init =
{
e.classname = "ambient_drip";
e.classtype = CT_MISC_AMBIENT_DRIP;

base_ambient_sound_init (e);

ambient_sound_drip (e.origin);
};

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

ambient_drip_init (self);
};
// };

/*QUAKED ambient_drone (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) X X X X X 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
*/
//----------------------------------------------------------------------
// class ambient_drone: base_ambient_sound
// {
//--------------------------------------------------------------
void(entity e) ambient_drone_init =
{
e.classname = "ambient_drone";
e.classtype = CT_MISC_AMBIENT_DRONE;

base_ambient_sound_init (e);

ambient_sound_drone (e.origin);
};

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

ambient_drone_init (self);
};
// };

/*QUAKED ambient_flouro_buzz (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) X X X X X 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
*/
//----------------------------------------------------------------------
// class ambient_flouro_buzz: base_ambient_sound
// {
//--------------------------------------------------------------
void(entity e) ambient_flouro_buzz_init =
{
e.classname = "ambient_flouro_buzz";
e.classtype = CT_MISC_AMBIENT_FBUZZ;

base_ambient_sound_init (e);

ambient_sound_fbuzz (e.origin);
};

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

ambient_flouro_buzz_init (self);
};
// };

/*QUAKED ambient_light_buzz (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) X X X X X 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
*/
//----------------------------------------------------------------------
// class ambient_light_buzz: base_ambient_sound
// {
//--------------------------------------------------------------
void(entity e) ambient_light_buzz_init =
{
e.classname = "ambient_light_buzz";
e.classtype = CT_MISC_AMBIENT_LBUZZ;

base_ambient_sound_init (e);

ambient_sound_lbuzz (e.origin);
};

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

ambient_light_buzz_init (self);
};
// };

/*QUAKED ambient_suck_wind (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) X X X X X 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
*/
//----------------------------------------------------------------------
// class ambient_suck_wind: base_ambient_sound
// {
//--------------------------------------------------------------
void(entity e) ambient_suck_wind_init =
{
e.classname = "ambient_suck_wind";
e.classtype = CT_MISC_AMBIENT_SUCKWIND;

base_ambient_sound_init (e);

ambient_sound_suckwind (e.origin);
};

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

ambient_suck_wind_init (self);
};
// };

/*QUAKED ambient_swamp1 (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) X X X X X 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
*/
//----------------------------------------------------------------------
// class ambient_swamp1: base_ambient_sound
// {
//--------------------------------------------------------------
void(entity e) ambient_swamp1_init =
{
e.classname = "ambient_swamp1";
e.classtype = CT_MISC_AMBIENT_SWAMP1;

base_ambient_sound_init (e);

ambient_sound_swamp1 (e.origin);
};

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

ambient_swamp1_init (self);
};
// };

/*QUAKED ambient_swamp2 (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) X X X X X 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
*/
//----------------------------------------------------------------------
// class ambient_swamp2: base_ambient_sound
// {
//--------------------------------------------------------------
void(entity e) ambient_swamp2_init =
{
e.classname = "ambient_swamp2";
e.classtype = CT_MISC_AMBIENT_SWAMP2;

base_ambient_sound_init (e);

ambient_sound_swamp2 (e.origin);
};

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

ambient_swamp2_init (self);
};
// };

/////////////////////////////////////////////////////////////
////////// dumptruck_ds ////////////////////////////////////
///////////////////////////////////////////////////////////

// Additions to Ambient Sound effects. These are hard coded into the engine and
// usually play back automatically when the sky or water textures are used. If
// you'd prefer to use these in custom setups, you can use the command line
// switch -nomabient in when you VIS your map to disable the hard coded sounds.

/*QUAKED ambient_water1 (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) X X X X X 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
*/
//----------------------------------------------------------------------
// class ambient_water1: base_ambient_sound
// {
//--------------------------------------------------------------
void(entity e) ambient_water1_init =
{
e.classname = "ambient_water1";
e.classtype = CT_MISC_AMBIENT_WATER1;

base_ambient_sound_init (e);

ambient_sound_water1 (e.origin);
};

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

ambient_water1_init (self);
};
// };

/*QUAKED ambient_wind2 (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) X X X X X 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
*/
//----------------------------------------------------------------------
// class ambient_wind2: base_ambient_sound
// {
//--------------------------------------------------------------
void(entity e) ambient_wind2_init =
{
e.classname = "ambient_wind2";
e.classtype = CT_MISC_AMBIENT_WIND2;

base_ambient_sound_init (e);

ambient_sound_wind2 (e.origin);
};

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

ambient_wind2_init (self);
};
// };

/////////////////////////////////////////////////////////////
////////// dumptruck_ds ////////////////////////////////////
///////////////////////////////////////////////////////////

// The original ambient_thunder was included in Quake but the code was missing.
// This version is borrowed from the Zerstörer mod but modified to only play the
// original thunder1.wav included in the game. This is also different than the
// other ambient sounds as it plays back randomly as opposed to looping. You
// only need one of these in your level. It will play everywhere.

/*QUAKED ambient_thunder (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) X X X X X 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
The original ambient_thunder was included in Quake but the code was missing.
This version is borrowed from the Zerstörer mod but modified to only play the
original thumder1.wav included in the game. This is also different than the
other ambient sounds as it plays back randomly as opposed to looping. You
only need one of these in your level. It will play everywhere.
*/
//----------------------------------------------------------------------
// class ambient_thunder: base_ambient_sound
// {
//--------------------------------------------------------------
void() ambient_thunder_think =
{
if (random() < 0.5)
sound (self, CHAN_AUTO, SND_AMBIENTHUNDER,
VOL_MID, ATTN_NONE);
else
sound (self, CHAN_AUTO, SND_AMBIENTHUNDER,
VOL_HIGH, ATTN_NONE);

self.nextthink = time + 40 * random ();
};

//--------------------------------------------------------------
void(entity e) ambient_thunder_init =
{
e.classname = "ambient_thunder";
e.classtype = CT_MISC_AMBIENT_THUNDER;

base_ambient_sound_init (e);

// changed from ambient to delayed sound (sounds better)
precache_sound (SND_AMBIENTHUNDER);
// this file in not included in the game
// precache_sound ("ambience/thunder2.wav");
e.think = ambient_thunder_think;
e.nextthink = time + random ();
};

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

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

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

Log ambient_sound.qc

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