trigger_teleport: more sound customization options
This commit is contained in:
parent
f606efcbf7
commit
89e3b961e8
1 changed files with 48 additions and 10 deletions
|
@ -20,7 +20,7 @@ enumflags
|
||||||
TRIGTELE_NOCLIENTS
|
TRIGTELE_NOCLIENTS
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!QUAKED trigger_teleport (.5 .5 .5) ?
|
/*!QUAKED trigger_teleport (.5 .5 .5) ? MONSTERS NOCLIENTS
|
||||||
# OVERVIEW
|
# OVERVIEW
|
||||||
Teleportation volume. Teleports anything it touches to the position of
|
Teleportation volume. Teleports anything it touches to the position of
|
||||||
any entity set as the "target". Works best with info_teleport_destination.
|
any entity set as the "target". Works best with info_teleport_destination.
|
||||||
|
@ -29,6 +29,10 @@ any entity set as the "target". Works best with info_teleport_destination.
|
||||||
- "targetname" : Name
|
- "targetname" : Name
|
||||||
- "target" : Which target to teleport to.
|
- "target" : Which target to teleport to.
|
||||||
|
|
||||||
|
# SPAWNFLAGS
|
||||||
|
- MONSTERS (1) : Allow monsters to use this teleporter.
|
||||||
|
- NOCLIENTS (2) : Disallow clients from using this teleporter.
|
||||||
|
|
||||||
# TRIVIA
|
# TRIVIA
|
||||||
This entity was introduced in Quake (1996).
|
This entity was introduced in Quake (1996).
|
||||||
*/
|
*/
|
||||||
|
@ -42,15 +46,38 @@ public:
|
||||||
|
|
||||||
virtual void Spawned(void);
|
virtual void Spawned(void);
|
||||||
virtual void Respawn(void);
|
virtual void Respawn(void);
|
||||||
|
virtual void SpawnKey(string, string);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
string m_sndTeleported;
|
string m_sndTeleport;
|
||||||
|
string m_sndTeleportEnter;
|
||||||
|
string m_sndTeleportExit;
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
trigger_teleport::trigger_teleport(void)
|
trigger_teleport::trigger_teleport(void)
|
||||||
{
|
{
|
||||||
m_sndTeleported = __NULL__;
|
m_sndTeleport = __NULL__;
|
||||||
|
m_sndTeleportEnter = __NULL__;
|
||||||
|
m_sndTeleportExit = __NULL__;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
trigger_teleport::SpawnKey(string strKey, string strValue)
|
||||||
|
{
|
||||||
|
switch (strKey) {
|
||||||
|
case "snd_teleport":
|
||||||
|
m_sndTeleport = strValue;
|
||||||
|
break;
|
||||||
|
case "snd_teleport_enter":
|
||||||
|
m_sndTeleportEnter = strValue;
|
||||||
|
break;
|
||||||
|
case "snd_teleport_exit":
|
||||||
|
m_sndTeleportExit = strValue;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
super::SpawnKey(strKey, strValue);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -58,11 +85,14 @@ trigger_teleport::Spawned(void)
|
||||||
{
|
{
|
||||||
super::Spawned();
|
super::Spawned();
|
||||||
|
|
||||||
/* if we're in Deathmatch Classic, force this soundDef */
|
if (m_sndTeleport)
|
||||||
if (cvar_string("fs_game") == "dmc") {
|
Sound_Precache(m_sndTeleport);
|
||||||
m_sndTeleported = "dmc_teleporter.teleported";
|
|
||||||
}
|
if (m_sndTeleportEnter)
|
||||||
Sound_Precache(m_sndTeleported);
|
Sound_Precache(m_sndTeleportEnter);
|
||||||
|
|
||||||
|
if (m_sndTeleportExit)
|
||||||
|
Sound_Precache(m_sndTeleportExit);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -96,8 +126,16 @@ trigger_teleport::Touch(entity eToucher)
|
||||||
if (eToucher.flags & FL_CLIENT)
|
if (eToucher.flags & FL_CLIENT)
|
||||||
Client_FixAngle(eToucher, eToucher.angles);
|
Client_FixAngle(eToucher, eToucher.angles);
|
||||||
|
|
||||||
if (m_sndTeleported) {
|
if (m_sndTeleport) {
|
||||||
Sound_Play(eToucher, CHAN_VOICE, m_sndTeleported);
|
Sound_Play(eToucher, CHAN_VOICE, m_sndTeleport);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_sndTeleportEnter) {
|
||||||
|
Sound_Play(this, CHAN_VOICE, m_sndTeleportEnter);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_sndTeleportExit) {
|
||||||
|
Sound_Play(eTarget, CHAN_VOICE, m_sndTeleportExit);
|
||||||
}
|
}
|
||||||
|
|
||||||
NSLog("^2trigger_teleport::^3Touch^7: Teleported '%s' to `%v`",
|
NSLog("^2trigger_teleport::^3Touch^7: Teleported '%s' to `%v`",
|
||||||
|
|
Loading…
Reference in a new issue