Remove deprecated falloff distance

This commit is contained in:
BeaR 2014-11-28 19:21:59 +01:00
parent d1327742e7
commit 9996751161
7 changed files with 2 additions and 27 deletions

View file

@ -49,7 +49,6 @@ struct CVoice
int m_Age; // increases when reused
int m_Tick;
int m_Vol; // 0 - 255
int m_FalloffDistance; // 0 - inifinitee (well int)
int m_Flags;
int m_X, m_Y;
} ;
@ -137,7 +136,7 @@ static void Mix(short *pFinalOut, unsigned Frames)
int dy = v->m_Y - m_CenterY;
int Dist = (int)sqrtf((float)dx*dx+dy*dy); // float here. nasty
int p = IntAbs(dx);
int Range = v->m_FalloffDistance;
int Range = DefaultDistance;
if(Dist >= 0 && Dist < Range)
{
// panning
@ -646,22 +645,6 @@ void CSound::SetVoiceVolume(CVoiceHandle Voice, float Volume)
m_aVoices[VoiceID].m_Vol = (int)(Volume*255.0f);
}
void CSound::SetVoiceMaxDistance(CVoiceHandle Voice, int Distance)
{
if(!Voice.IsValid())
return;
int VoiceID = Voice.Id();
if(m_aVoices[VoiceID].m_Age != Voice.Age())
return;
if(Distance < 0)
return;
m_aVoices[VoiceID].m_FalloffDistance = Distance;
}
void CSound::SetVoiceLocation(CVoiceHandle Voice, float x, float y)
{
if(!Voice.IsValid())
@ -752,7 +735,6 @@ ISound::CVoiceHandle CSound::Play(int ChannelID, int SampleID, int Flags, float
m_aVoices[VoiceID].m_Flags = Flags;
m_aVoices[VoiceID].m_X = (int)x;
m_aVoices[VoiceID].m_Y = (int)y;
m_aVoices[VoiceID].m_FalloffDistance = DefaultDistance;
Age = m_aVoices[VoiceID].m_Age;
}

View file

@ -41,7 +41,6 @@ public:
virtual void SetChannel(int ChannelID, float Vol, float Pan);
virtual void SetVoiceVolume(CVoiceHandle Voice, float Volume);
virtual void SetVoiceMaxDistance(CVoiceHandle Voice, int Distance);
virtual void SetVoiceLocation(CVoiceHandle Voice, float x, float y);
virtual void SetVoiceTimeOffset(CVoiceHandle Voice, float offset); // in s

View file

@ -48,7 +48,6 @@ public:
virtual void SetListenerPos(float x, float y) = 0;
virtual void SetVoiceVolume(CVoiceHandle Voice, float Volume) = 0;
virtual void SetVoiceMaxDistance(CVoiceHandle Voice, int Distance) = 0;
virtual void SetVoiceLocation(CVoiceHandle Voice, float x, float y) = 0;
virtual void SetVoiceTimeOffset(CVoiceHandle Voice, float offset) = 0; // in s

View file

@ -122,7 +122,6 @@ void CMapSounds::OnRender()
if(pSource->m_pSource->m_Loop) Flags |= ISound::FLAG_LOOP;
pSource->m_Voice = m_pClient->m_pSounds->PlaySampleAt(CSounds::CHN_MAPSOUND, m_aSounds[pSource->m_Sound], 1.0f, vec2(fx2f(pSource->m_pSource->m_Position.x), fx2f(pSource->m_pSource->m_Position.y)), Flags);
Sound()->SetVoiceMaxDistance(pSource->m_Voice, pSource->m_pSource->m_FalloffDistance);
Sound()->SetVoiceTimeOffset(pSource->m_Voice, offset);
}
}

View file

@ -40,7 +40,7 @@ void CLayerSounds::Render()
OffsetY = aChannels[1];
}
m_pEditor->RenderTools()->DrawCircle(fx2f(pSource->m_Position.x)+OffsetX, fx2f(pSource->m_Position.y)+OffsetY, pSource->m_FalloffDistance, 32);
m_pEditor->RenderTools()->DrawCircle(fx2f(pSource->m_Position.x)+OffsetX, fx2f(pSource->m_Position.y)+OffsetY, 2500.0f, 32); // fix
}
Graphics()->QuadsEnd();
@ -84,7 +84,6 @@ CSoundSource *CLayerSounds::NewSource()
pSource->m_Loop = 1;
pSource->m_TimeDelay = 0;
pSource->m_FalloffDistance = 1500;
pSource->m_PosEnv = -1;
pSource->m_PosEnvOffset = 0;

View file

@ -643,7 +643,6 @@ int CEditor::PopupSource(CEditor *pEditor, CUIRect View)
{"Pos Y", pSource->m_Position.y/1000, PROPTYPE_INT_SCROLL, -1000000, 1000000},
{"Loop", pSource->m_Loop, PROPTYPE_BOOL, 0, 1},
{"Delay", pSource->m_TimeDelay, PROPTYPE_INT_SCROLL, 0, 1000000},
{"Distance", pSource->m_FalloffDistance, PROPTYPE_INT_SCROLL, 0, 1000000},
{"Pos. Env", pSource->m_PosEnv+1, PROPTYPE_INT_STEP, 0, pEditor->m_Map.m_lEnvelopes.size()+1},
{"Pos. TO", pSource->m_PosEnvOffset, PROPTYPE_INT_SCROLL, -1000000, 1000000},
{"Sound Env", pSource->m_SoundEnv+1, PROPTYPE_INT_STEP, 0, pEditor->m_Map.m_lEnvelopes.size()+1},
@ -662,7 +661,6 @@ int CEditor::PopupSource(CEditor *pEditor, CUIRect View)
if(Prop == PROP_POS_Y) pSource->m_Position.y = NewVal*1000;
if(Prop == PROP_LOOP) pSource->m_Loop = NewVal;
if(Prop == PROP_TIME_DELAY) pSource->m_TimeDelay = NewVal;
if(Prop == PROP_DISTANCE) pSource->m_FalloffDistance = NewVal;
if(Prop == PROP_POS_ENV)
{
int Index = clamp(NewVal-1, -1, pEditor->m_Map.m_lEnvelopes.size()-1);

View file

@ -365,7 +365,6 @@ struct CSoundSource
CPoint m_Position;
int m_Loop;
int m_TimeDelay; // in s
int m_FalloffDistance;
int m_Falloff; // [0,255] // 0 - No falloff, 255 - full
int m_PosEnv;