Skip to content

Commit

Permalink
Sound: fix duplicate menu effects
Browse files Browse the repository at this point in the history
  • Loading branch information
IonAgorria committed Mar 28, 2024
1 parent 5bdd75d commit 50e2d33
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
6 changes: 3 additions & 3 deletions Source/Scripts/SoundScript.prm
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,19 @@ SoundScriptPrm mainmenuSoundPrm = {
{
name = "menu_rectangle";
soundName = new string[] { "menu\\menu_rectangle" };
max_num_sound = 2;
max_num_sound = 1;
},
{
name = "menu_button_switth_1";
soundName = new string[] { "menu\\menu_button_switch_1" };
max_num_sound = 2;
max_num_sound = 1;
volume = 0.2;
},
{
name = "menu_button_switth_2";
soundName = new string[] { "menu\\menu_button_switch_2" };
volume = 0.4;
max_num_sound = 2;
max_num_sound = 1;
},
{
name = "mainmenu_clock";
Expand Down
10 changes: 8 additions & 2 deletions Source/UserInterface/PerimeterShellUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4933,12 +4933,18 @@ void CScaleButton::draw(int bFocus)
{ phase=1; if (!OnEffectStop(m_effect)) return; }
else if( phase<=_fEffectButtonTime1 )
{
if( !snd1 && soundEnabled ) SND2DPlaySound( "menu_button_switth_1"), snd1=1;
if( !snd1 && soundEnabled ) {
SND2DPlaySound( "menu_button_switth_1");
snd1=1;
}
phase/=_fEffectButtonTime1, _sy=sy*0.1f, _sx=sx*phase, _size=0;
}
else if( (phase-=_fEffectButtonTime1)<=_fEffectButtonTime2 )
{
if( !snd2 && soundEnabled ) SND2DPlaySound( "menu_button_switth_2"), snd2=1;
if( !snd2 && soundEnabled ) {
SND2DPlaySound( "menu_button_switth_2");
snd2=1;
}
phase/=_fEffectButtonTime2, _sy=sy*phase, _size=size*phase, Color3= xm::round(128 * phase);
}
else if( (phase-=_fEffectButtonTime2)<=_fEffectButtonTime3 )
Expand Down

0 comments on commit 50e2d33

Please sign in to comment.