From 78c0c01f78b649bdc8e74c7c14d07590070a8765 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Wed, 13 Feb 2008 12:04:57 +0000 Subject: small modification to the FadeTo function... it can now take a TAudioPlaybackStream as an optional 2nd paramater. so you can do a screen fade & play the swoosh sound, in 1 function call. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@848 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Menu/UMenu.pas | 12 ++++++++++-- Game/Code/Screens/UScreenMain.pas | 35 +++++++++++++---------------------- 2 files changed, 23 insertions(+), 24 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Menu/UMenu.pas b/Game/Code/Menu/UMenu.pas index e6bb6b45..339402a2 100644 --- a/Game/Code/Menu/UMenu.pas +++ b/Game/Code/Menu/UMenu.pas @@ -9,7 +9,7 @@ interface {$I switches.inc} uses OpenGL12, SysUtils, UTexture, UMenuStatic, UMenuText, UMenuButton, UMenuSelect, UMenuSelectSlide, - UMenuInteract, UThemes, UMenuButtonCollection, Math; + UMenuInteract, UThemes, UMenuButtonCollection, Math, UMusic; type { Int16 = SmallInt;} @@ -112,7 +112,8 @@ type // function AddWidget(X, Y : UInt16; WidgetSrc : PSDL_Surface): Int16; // procedure ClearWidgets(MinNumber : Int16); - procedure FadeTo(Screen: PMenu); + procedure FadeTo(Screen: PMenu); overload; + procedure FadeTo(Screen: PMenu; aSound: TAudioPlaybackStream); overload; //popup hack procedure CheckFadeTo(Screen: PMenu; msg: String); @@ -967,6 +968,13 @@ begin Display.NextScreen := Screen; end; +procedure TMenu.FadeTo(Screen: PMenu; aSound: TAudioPlaybackStream); +begin + FadeTo( Screen ); + AudioPlayback.PlaySound( aSound ); +end; + + //popup hack procedure TMenu.CheckFadeTo(Screen: PMenu; msg: String); begin diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index 5824d9fe..cc2ccc80 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -94,29 +94,25 @@ begin //Credits_Y := 600; //Credits_Alpha := 0; //Credits_Visible := True; - AudioPlayback.PlaySound(SoundLib.Start); - FadeTo(@ScreenCredits); + FadeTo(@ScreenCredits , SoundLib.Start ); end; end; SDLK_M: begin if (Ini.Players >= 1) AND (Length(DLLMan.Plugins)>=1) then begin - AudioPlayback.PlaySound(SoundLib.Start); - FadeTo(@ScreenPartyOptions); + FadeTo(@ScreenPartyOptions, SoundLib.Start); end; end; SDLK_S: begin - AudioPlayback.PlaySound(SoundLib.Start); - FadeTo(@ScreenStatMain); + FadeTo(@ScreenStatMain, SoundLib.Start); end; SDLK_E: begin - AudioPlayback.PlaySound(SoundLib.Start); - FadeTo(@ScreenEdit); + FadeTo(@ScreenEdit, SoundLib.Start); end; SDLK_RETURN: @@ -126,12 +122,11 @@ begin begin if (Songs.SongList.Count >= 1) then begin - AudioPlayback.PlaySound(SoundLib.Start); if (Ini.Players >= 0) and (Ini.Players <= 3) then PlayersPlay := Ini.Players + 1; if (Ini.Players = 4) then PlayersPlay := 6; ScreenName.Goto_SingScreen := False; - FadeTo(@ScreenName); + FadeTo(@ScreenName, SoundLib.Start); end else //show error message ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_SONGS')); @@ -144,8 +139,7 @@ begin begin if (Length(DLLMan.Plugins)>=1) then begin - AudioPlayback.PlaySound(SoundLib.Start); - FadeTo(@ScreenPartyOptions); + FadeTo(@ScreenPartyOptions, SoundLib.Start); end else //show error message, No Plugins Loaded ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_PLUGINS')); @@ -157,22 +151,19 @@ begin //Stats if Interaction = 2 then begin - AudioPlayback.PlaySound(SoundLib.Start); - FadeTo(@ScreenStatMain); + FadeTo(@ScreenStatMain, SoundLib.Start); end; //Editor if Interaction = 3 then begin - AudioPlayback.PlaySound(SoundLib.Start); - FadeTo(@ScreenEdit); + FadeTo(@ScreenEdit, SoundLib.Start); end; //Options if Interaction = 4 then begin - AudioPlayback.PlaySound(SoundLib.Start); - FadeTo(@ScreenOptions); + FadeTo(@ScreenOptions, SoundLib.Start); end; //Exit @@ -214,7 +205,7 @@ begin //---------------- - TextDescription := AddText(Theme.Main.TextDescription); + TextDescription := AddText(Theme.Main.TextDescription); TextDescriptionLong := AddText(Theme.Main.TextDescriptionLong); LoadFromTheme(Theme.Main); @@ -238,7 +229,7 @@ end; procedure TScreenMain.InteractNext; begin inherited InteractNext; - Text[TextDescription].Text := Theme.Main.Description[Interaction]; + Text[TextDescription].Text := Theme.Main.Description[Interaction]; Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; UpdateLCD; Light.LightOne(1, 200); @@ -247,7 +238,7 @@ end; procedure TScreenMain.InteractPrev; begin inherited InteractPrev; - Text[TextDescription].Text := Theme.Main.Description[Interaction]; + Text[TextDescription].Text := Theme.Main.Description[Interaction]; Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; UpdateLCD; Light.LightOne(0, 200); @@ -256,7 +247,7 @@ end; procedure TScreenMain.InteractDec; begin inherited InteractDec; - Text[TextDescription].Text := Theme.Main.Description[Interaction]; + Text[TextDescription].Text := Theme.Main.Description[Interaction]; Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; UpdateLCD; Light.LightOne(0, 200); -- cgit v1.2.3