func_train: Fix the moving sound from not stopping on certain variations
of this entity
This commit is contained in:
parent
8d262c9eb2
commit
d5ae0c8dfd
1 changed files with 25 additions and 14 deletions
|
@ -57,6 +57,8 @@ class func_train:CBaseTrigger
|
|||
string m_strStopSnd;
|
||||
|
||||
void(void) func_train;
|
||||
virtual void(void) SoundMove;
|
||||
virtual void(void) SoundStop;
|
||||
virtual void(void) AfterSpawn;
|
||||
virtual void(void) PathNext;
|
||||
virtual void(void) PathMove;
|
||||
|
@ -82,6 +84,26 @@ func_train::Blocked(void)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
func_train::SoundMove(void)
|
||||
{
|
||||
if (m_strMoveSnd) {
|
||||
Sound_Play(this, CHAN_VOICE, m_strMoveSnd);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
func_train::SoundStop(void)
|
||||
{
|
||||
if (m_strStopSnd) {
|
||||
Sound_Play(this, CHAN_BODY, m_strStopSnd);
|
||||
}
|
||||
|
||||
if (m_strMoveSnd) {
|
||||
sound(this, CHAN_VOICE, "common/null.wav", 1.0, ATTN_NORM);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
func_train::PathMove(void)
|
||||
{
|
||||
|
@ -110,10 +132,7 @@ func_train::PathMove(void)
|
|||
return;
|
||||
}
|
||||
|
||||
/* more stuff for the ears */
|
||||
if (m_strMoveSnd) {
|
||||
Sound_Play(this, CHAN_VOICE, m_strMoveSnd);
|
||||
}
|
||||
SoundMove();
|
||||
|
||||
velocity = (vecVelocity * (1 / flTravelTime));
|
||||
think = PathNext;
|
||||
|
@ -134,16 +153,7 @@ func_train::PathDone(void)
|
|||
if (eNode.m_strMessage) {
|
||||
eNode.Trigger(this, TRIG_TOGGLE);
|
||||
}
|
||||
|
||||
/* stuff for the ears */
|
||||
if (m_strStopSnd) {
|
||||
Sound_Play(this, CHAN_BODY, m_strStopSnd);
|
||||
}
|
||||
|
||||
/* make the loopy noise stop */
|
||||
if (m_strMoveSnd) {
|
||||
sound(this, CHAN_VOICE, "common/null.wav", 1.0, ATTN_NORM);
|
||||
}
|
||||
SoundStop();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -175,6 +185,7 @@ func_train::PathNext(void)
|
|||
/* stop until triggered again */
|
||||
if (targetname)
|
||||
if (eNode.spawnflags & PC_WAIT || spawnflags & TRAIN_WAIT) {
|
||||
SoundStop();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue