trigger_teleport: more sound customization options

This commit is contained in:
Marco Cawthorne 2023-04-30 17:59:49 -07:00
parent f606efcbf7
commit 89e3b961e8
Signed by: eukara
GPG Key ID: CE2032F0A2882A22
1 changed files with 48 additions and 10 deletions

View File

@ -20,7 +20,7 @@ enumflags
TRIGTELE_NOCLIENTS
};
/*!QUAKED trigger_teleport (.5 .5 .5) ?
/*!QUAKED trigger_teleport (.5 .5 .5) ? MONSTERS NOCLIENTS
# OVERVIEW
Teleportation volume. Teleports anything it touches to the position of
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
- "target" : Which target to teleport to.
# SPAWNFLAGS
- MONSTERS (1) : Allow monsters to use this teleporter.
- NOCLIENTS (2) : Disallow clients from using this teleporter.
# TRIVIA
This entity was introduced in Quake (1996).
*/
@ -42,15 +46,38 @@ public:
virtual void Spawned(void);
virtual void Respawn(void);
virtual void SpawnKey(string, string);
private:
string m_sndTeleported;
string m_sndTeleport;
string m_sndTeleportEnter;
string m_sndTeleportExit;
};
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
@ -58,11 +85,14 @@ trigger_teleport::Spawned(void)
{
super::Spawned();
/* if we're in Deathmatch Classic, force this soundDef */
if (cvar_string("fs_game") == "dmc") {
m_sndTeleported = "dmc_teleporter.teleported";
}
Sound_Precache(m_sndTeleported);
if (m_sndTeleport)
Sound_Precache(m_sndTeleport);
if (m_sndTeleportEnter)
Sound_Precache(m_sndTeleportEnter);
if (m_sndTeleportExit)
Sound_Precache(m_sndTeleportExit);
}
void
@ -96,8 +126,16 @@ trigger_teleport::Touch(entity eToucher)
if (eToucher.flags & FL_CLIENT)
Client_FixAngle(eToucher, eToucher.angles);
if (m_sndTeleported) {
Sound_Play(eToucher, CHAN_VOICE, m_sndTeleported);
if (m_sndTeleport) {
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`",