func_door(_rotating): Support for separate sound shaders handling opening
and closing of doors. See QUAKED comment in WorldSpawn for details.
This commit is contained in:
parent
d37c4d9d0a
commit
ce8731079f
2 changed files with 50 additions and 24 deletions
|
@ -24,8 +24,9 @@
|
||||||
"wait" When to move back.
|
"wait" When to move back.
|
||||||
"netname" Target to trigger when door returns to its initial position.
|
"netname" Target to trigger when door returns to its initial position.
|
||||||
"dmg" Damage to inflict upon anything blocking the way.
|
"dmg" Damage to inflict upon anything blocking the way.
|
||||||
"noise1" Path to sound sample to play when the door is moving.
|
"snd_open" Sound shader to play for when the door opens.
|
||||||
"noise2" Path to sound sample to play when the door stops moving.
|
"snd_close" Sound shader to play for when the door closes.
|
||||||
|
"snd_stop" Sound shader to play for when the door stops moving.
|
||||||
"movesnd" Legacy integer value pointing to a predefined move sound.
|
"movesnd" Legacy integer value pointing to a predefined move sound.
|
||||||
"stopsnd" Legacy integer value pointing to a predefined stop sound.
|
"stopsnd" Legacy integer value pointing to a predefined stop sound.
|
||||||
|
|
||||||
|
@ -89,7 +90,8 @@ class func_door:CBaseTrigger
|
||||||
int m_iDamage;
|
int m_iDamage;
|
||||||
int m_iLocked;
|
int m_iLocked;
|
||||||
|
|
||||||
string m_strSndMove;
|
string m_strSndOpen;
|
||||||
|
string m_strSndClose;
|
||||||
string m_strSndStop;
|
string m_strSndStop;
|
||||||
|
|
||||||
void(void) func_door;
|
void(void) func_door;
|
||||||
|
@ -176,8 +178,8 @@ func_door::Returned(void)
|
||||||
void
|
void
|
||||||
func_door::MoveBack(void)
|
func_door::MoveBack(void)
|
||||||
{
|
{
|
||||||
if (m_strSndMove) {
|
if (m_strSndClose) {
|
||||||
Sound_Play(this, CHAN_VOICE, m_strSndMove);
|
Sound_Play(this, CHAN_VOICE, m_strSndClose);
|
||||||
} else {
|
} else {
|
||||||
sound(this, CHAN_VOICE, "common/null.wav", 1.0f, ATTN_NORM);
|
sound(this, CHAN_VOICE, "common/null.wav", 1.0f, ATTN_NORM);
|
||||||
}
|
}
|
||||||
|
@ -198,8 +200,8 @@ func_door::MoveAway(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_strSndMove) {
|
if (m_strSndOpen) {
|
||||||
Sound_Play(this, CHAN_VOICE, m_strSndMove);
|
Sound_Play(this, CHAN_VOICE, m_strSndOpen);
|
||||||
} else {
|
} else {
|
||||||
sound(this, CHAN_VOICE, "common/null.wav", 1.0f, ATTN_NORM);
|
sound(this, CHAN_VOICE, "common/null.wav", 1.0f, ATTN_NORM);
|
||||||
}
|
}
|
||||||
|
@ -422,16 +424,23 @@ func_door::SpawnKey(string strKey, string strValue)
|
||||||
case "dmg":
|
case "dmg":
|
||||||
m_iDamage = stoi(strValue);
|
m_iDamage = stoi(strValue);
|
||||||
break;
|
break;
|
||||||
case "noise1":
|
case "snd_open":
|
||||||
m_strSndMove = strValue;
|
m_strSndOpen = strValue;
|
||||||
break;
|
break;
|
||||||
|
case "snd_close":
|
||||||
|
m_strSndClose = strValue;
|
||||||
|
break;
|
||||||
|
case "noise1":
|
||||||
|
m_strSndOpen = m_strSndClose = strValue;
|
||||||
|
break;
|
||||||
|
case "snd_stop":
|
||||||
case "noise2":
|
case "noise2":
|
||||||
m_strSndStop = strValue;
|
m_strSndStop = strValue;
|
||||||
break;
|
break;
|
||||||
/* GoldSrc compat */
|
/* GoldSrc compat */
|
||||||
case "movesnd":
|
case "movesnd":
|
||||||
x = stoi(strValue);
|
x = stoi(strValue);
|
||||||
m_strSndMove = sprintf("func_door.move_%i", x);
|
m_strSndOpen = m_strSndClose = sprintf("func_door.move_%i", x);
|
||||||
break;
|
break;
|
||||||
case "stopsnd":
|
case "stopsnd":
|
||||||
x = stoi(strValue);
|
x = stoi(strValue);
|
||||||
|
@ -447,8 +456,10 @@ func_door::func_door(void)
|
||||||
{
|
{
|
||||||
CBaseTrigger::CBaseTrigger();
|
CBaseTrigger::CBaseTrigger();
|
||||||
|
|
||||||
if (m_strSndMove)
|
if (m_strSndOpen)
|
||||||
Sound_Precache(m_strSndMove);
|
Sound_Precache(m_strSndOpen);
|
||||||
|
if (m_strSndClose)
|
||||||
|
Sound_Precache(m_strSndClose);
|
||||||
if (m_strSndStop)
|
if (m_strSndStop)
|
||||||
Sound_Precache(m_strSndStop);
|
Sound_Precache(m_strSndStop);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,8 +19,11 @@
|
||||||
"target" Target when triggered.
|
"target" Target when triggered.
|
||||||
"killtarget" Target to kill when triggered.
|
"killtarget" Target to kill when triggered.
|
||||||
"speed" Speed at which the door turns.
|
"speed" Speed at which the door turns.
|
||||||
"noise1" Sound shader name to play for when the door moves.
|
"snd_open" Sound shader to play for when the door opens.
|
||||||
"noise2" Sound shader name to play for when the door stops.
|
"snd_close" Sound shader to play for when the door closes.
|
||||||
|
"snd_stop" Sound shader to play for when the door stops rotating.
|
||||||
|
"movesnd" Legacy integer value pointing to a predefined move sound.
|
||||||
|
"stopsnd" Legacy integer value pointing to a predefined stop sound.
|
||||||
"distance" The degrees which the door will turn.
|
"distance" The degrees which the door will turn.
|
||||||
"dmg" The damage inflicted upon objects blocking the way of the door.
|
"dmg" The damage inflicted upon objects blocking the way of the door.
|
||||||
"wait" Time that has to pass for the door to automatically close.
|
"wait" Time that has to pass for the door to automatically close.
|
||||||
|
@ -63,8 +66,11 @@ enumflags
|
||||||
class func_door_rotating:CBaseTrigger
|
class func_door_rotating:CBaseTrigger
|
||||||
{
|
{
|
||||||
string targetClose;
|
string targetClose;
|
||||||
string m_strSndMove;
|
|
||||||
string m_strSndStop;
|
string m_strSndStop;
|
||||||
|
|
||||||
|
string m_strSndOpen;
|
||||||
|
string m_strSndClose;
|
||||||
|
|
||||||
int m_iDamage;
|
int m_iDamage;
|
||||||
int m_iLocked;
|
int m_iLocked;
|
||||||
float m_flDistance;
|
float m_flDistance;
|
||||||
|
@ -168,8 +174,8 @@ void func_door_rotating::Back(void)
|
||||||
{
|
{
|
||||||
if (!(spawnflags & SF_DOOR_SILENT)) {
|
if (!(spawnflags & SF_DOOR_SILENT)) {
|
||||||
|
|
||||||
if (m_strSndMove) {
|
if (m_strSndClose) {
|
||||||
Sound_Play(this, CHAN_VOICE, m_strSndMove);
|
Sound_Play(this, CHAN_VOICE, m_strSndClose);
|
||||||
} else {
|
} else {
|
||||||
sound(this, CHAN_VOICE, "common/null.wav", 1.0f, ATTN_NORM);
|
sound(this, CHAN_VOICE, "common/null.wav", 1.0f, ATTN_NORM);
|
||||||
}
|
}
|
||||||
|
@ -192,8 +198,8 @@ void func_door_rotating::Away(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(spawnflags & SF_DOOR_SILENT)) {
|
if (!(spawnflags & SF_DOOR_SILENT)) {
|
||||||
if (m_strSndMove) {
|
if (m_strSndOpen) {
|
||||||
Sound_Play(this, CHAN_VOICE, m_strSndMove);
|
Sound_Play(this, CHAN_VOICE, m_strSndOpen);
|
||||||
} else {
|
} else {
|
||||||
sound(this, CHAN_VOICE, "common/null.wav", 1.0f, ATTN_NORM);
|
sound(this, CHAN_VOICE, "common/null.wav", 1.0f, ATTN_NORM);
|
||||||
}
|
}
|
||||||
|
@ -402,16 +408,23 @@ func_door_rotating::SpawnKey(string strKey, string strValue)
|
||||||
/*case "lip":
|
/*case "lip":
|
||||||
m_flLip = stof(strValue);
|
m_flLip = stof(strValue);
|
||||||
break;*/
|
break;*/
|
||||||
case "noise1":
|
case "snd_open":
|
||||||
m_strSndMove = strValue;
|
m_strSndOpen = strValue;
|
||||||
break;
|
break;
|
||||||
|
case "snd_close":
|
||||||
|
m_strSndClose = strValue;
|
||||||
|
break;
|
||||||
|
case "noise1":
|
||||||
|
m_strSndOpen = m_strSndClose = strValue;
|
||||||
|
break;
|
||||||
|
case "snd_stop":
|
||||||
case "noise2":
|
case "noise2":
|
||||||
m_strSndStop = strValue;
|
m_strSndStop = strValue;
|
||||||
break;
|
break;
|
||||||
/* GoldSrc compat */
|
/* GoldSrc compat */
|
||||||
case "movesnd":
|
case "movesnd":
|
||||||
x = stoi(strValue);
|
x = stoi(strValue);
|
||||||
m_strSndMove = sprintf("func_door_rotating.move_%i", x);
|
m_strSndOpen = m_strSndClose = sprintf("func_door_rotating.move_%i", x);
|
||||||
break;
|
break;
|
||||||
case "stopsnd":
|
case "stopsnd":
|
||||||
x = stoi(strValue);
|
x = stoi(strValue);
|
||||||
|
@ -442,8 +455,10 @@ void func_door_rotating::func_door_rotating(void)
|
||||||
|
|
||||||
CBaseTrigger::CBaseTrigger();
|
CBaseTrigger::CBaseTrigger();
|
||||||
|
|
||||||
if (m_strSndMove)
|
if (m_strSndOpen)
|
||||||
Sound_Precache(m_strSndMove);
|
Sound_Precache(m_strSndOpen);
|
||||||
|
if (m_strSndClose)
|
||||||
|
Sound_Precache(m_strSndClose);
|
||||||
if (m_strSndStop)
|
if (m_strSndStop)
|
||||||
Sound_Precache(m_strSndStop);
|
Sound_Precache(m_strSndStop);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue