targ_speaker: Initial implementation. It plays a sound - that's it. Read the trivia for more info.
This commit is contained in:
parent
278e984eaf
commit
348052dd76
2 changed files with 72 additions and 0 deletions
|
@ -52,6 +52,7 @@ server/stubs.cpp
|
|||
server/infodecal.cpp
|
||||
server/player_weaponstrip.cpp
|
||||
server/player_loadsaved.cpp
|
||||
server/targ_speaker.cpp
|
||||
server/target_cdaudio.cpp
|
||||
server/trigger_auto.cpp
|
||||
server/trigger_autosave.cpp
|
||||
|
|
71
src/gs-entbase/server/targ_speaker.cpp
Normal file
71
src/gs-entbase/server/targ_speaker.cpp
Normal file
|
@ -0,0 +1,71 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/*QUAKED targ_speaker (1 0 0) (-8 -8 -8) (8 8 8)
|
||||
"targetname" Name
|
||||
"target" Target when triggered
|
||||
"killtarget" Target to kill when triggered
|
||||
"tsnoise" Path to the sound file
|
||||
"volume" Volume to play the sound as (normalized, 0.0 - 1.0)
|
||||
|
||||
This entity plays a sample upon triggering at a specified volume.
|
||||
|
||||
Trivia:
|
||||
It was introduced in Gunman Chronicles.
|
||||
It's not any more useful than an ambient_generic.
|
||||
I suspect it's a carry-over from when Gunman was a Quake II mod, as
|
||||
Quake/Quake II did not have an entity that allowed custom sound samples
|
||||
to be played.
|
||||
*/
|
||||
|
||||
class targ_speaker:CBaseTrigger
|
||||
{
|
||||
string m_strSample;
|
||||
float m_flVolume;
|
||||
|
||||
void(void) targ_speaker;
|
||||
|
||||
virtual void(entity,int) Trigger;
|
||||
};
|
||||
|
||||
void
|
||||
targ_speaker::Trigger(entity act, int state)
|
||||
{
|
||||
if (GetMaster() == FALSE)
|
||||
return;
|
||||
|
||||
sound(this, CHAN_AUTO, m_strSample, m_flVolume, ATTN_NORM);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
targ_speaker::targ_speaker(void)
|
||||
{
|
||||
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
|
||||
switch (argv(i)) {
|
||||
case "tsnoise":
|
||||
m_strSample = argv(i+1);
|
||||
break;
|
||||
case "volume":
|
||||
m_flVolume = stof(argv(i+1));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
CBaseTrigger::CBaseTrigger();
|
||||
}
|
Loading…
Reference in a new issue