From 0aeea2f7687d037282ff5ebd85ac361f19474c39 Mon Sep 17 00:00:00 2001 From: mogguh Date: Sat, 23 Aug 2008 12:40:29 +0000 Subject: Visualization are now available and configurable via the options graphics screen git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1286 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UIni.pas | 26 +++++++++++++-- Game/Code/Classes/UThemes.pas | 2 ++ Game/Code/Screens/UScreenOptionsGraphics.pas | 12 +++---- Game/Code/Screens/UScreenSing.pas | 49 +++++++++++++++++++++------- 4 files changed, 68 insertions(+), 21 deletions(-) (limited to 'Game') diff --git a/Game/Code/Classes/UIni.pas b/Game/Code/Classes/UIni.pas index c7160ac0..c66a10c7 100644 --- a/Game/Code/Classes/UIni.pas +++ b/Game/Code/Classes/UIni.pas @@ -38,6 +38,11 @@ type end; type + +//Options + + TVisualizerOption = (voOff, voWhenNoVideo, voOn); + TIni = class private function RemoveFileExt(FullName: string): string; @@ -76,6 +81,7 @@ type Screens: integer; Resolution: integer; Depth: integer; + VisualizerOption:integer; FullScreen: integer; TextureSize: integer; SingWindow: integer; @@ -90,8 +96,8 @@ type BeatClick: integer; SavePlayback: integer; ThresholdIndex: integer; - AudioOutputBufferSizeIndex: integer; - VoicePassthrough: integer; + AudioOutputBufferSizeIndex:integer; + VoicePassthrough:integer; //Song Preview PreviewVolume: integer; @@ -136,6 +142,8 @@ var ITheme: array of string; ISkin: array of string; + + const IPlayers: array[0..4] of string = ('1', '2', '3', '4', '6'); IPlayersVals: array[0..4] of integer = ( 1 , 2 , 3 , 4 , 6 ); @@ -158,6 +166,7 @@ const IScreens: array[0..1] of string = ('1', '2'); IFullScreen: array[0..1] of string = ('Off', 'On'); IDepth: array[0..1] of string = ('16 bit', '32 bit'); + IVisualizer: array[0..2] of string = ('Off', 'WhenNoVideo','On'); ITextureSize: array[0..2] of string = ('128', '256', '512'); ITextureSizeVals: array[0..2] of integer = ( 128, 256, 512); @@ -699,6 +708,14 @@ begin // ScreenFade ScreenFade := GetArrayIndex(IScreenFade, IniFile.ReadString('Advanced', 'ScreenFade', 'On')); + // Visualizations + // this could be of use later.. + // VisualizerOption := + // TVisualizerOption(GetEnumValue(TypeInfo(TVisualizerOption), + // IniFile.ReadString('Graphics', 'Visualization', 'Off'))); + // || VisualizerOption := TVisualizerOption(GetArrayIndex(IVisualizer, IniFile.ReadString('Graphics', 'Visualization', 'Off'))); + VisualizerOption := GetArrayIndex(IVisualizer, IniFile.ReadString('Graphics', 'Visualization', 'Off')); + // EffectSing EffectSing := GetArrayIndex(IEffectSing, IniFile.ReadString('Advanced', 'EffectSing', 'On')); @@ -758,6 +775,9 @@ begin // FullScreen IniFile.WriteString('Graphics', 'FullScreen', IFullScreen[FullScreen]); + // Visualization + IniFile.WriteString('Graphics', 'Visualization', IVisualizer[VisualizerOption]); + // Resolution IniFile.WriteString('Graphics', 'Resolution', IResolution[Resolution]); @@ -800,7 +820,7 @@ begin // SavePlayback IniFile.WriteString('Sound', 'SavePlayback', ISavePlayback[SavePlayback]); - // NoteLines + // VoicePasstrough IniFile.WriteString('Sound', 'VoicePassthrough', IVoicePassthrough[VoicePassthrough]); // Lyrics Font diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index f5e15103..46327b7c 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -399,6 +399,7 @@ type SelectFullscreen: TThemeSelectSlide; SelectResolution: TThemeSelectSlide; SelectDepth: TThemeSelectSlide; + SelectVisualizer: TThemeSelectSlide; SelectOscilloscope: TThemeSelectSlide; SelectLineBonus: TThemeSelectSlide; SelectMovieSize: TThemeSelectSlide; @@ -1149,6 +1150,7 @@ begin ThemeLoadSelectSlide(OptionsGraphics.SelectFullscreen, 'OptionsGraphicsSelectFullscreen'); ThemeLoadSelectSlide(OptionsGraphics.SelectResolution, 'OptionsGraphicsSelectSlideResolution'); ThemeLoadSelectSlide(OptionsGraphics.SelectDepth, 'OptionsGraphicsSelectDepth'); + ThemeLoadSelectSlide(OptionsGraphics.SelectVisualizer, 'OptionsGraphicsSelectVisualizer'); ThemeLoadSelectSlide(OptionsGraphics.SelectOscilloscope, 'OptionsGraphicsSelectOscilloscope'); ThemeLoadSelectSlide(OptionsGraphics.SelectLineBonus, 'OptionsGraphicsSelectLineBonus'); ThemeLoadSelectSlide(OptionsGraphics.SelectMovieSize, 'OptionsGraphicsSelectMovieSize'); diff --git a/Game/Code/Screens/UScreenOptionsGraphics.pas b/Game/Code/Screens/UScreenOptionsGraphics.pas index 08fca99d..f2b6faa2 100644 --- a/Game/Code/Screens/UScreenOptionsGraphics.pas +++ b/Game/Code/Screens/UScreenOptionsGraphics.pas @@ -17,7 +17,7 @@ type implementation -uses UGraphic, UMain, SysUtils; +uses UGraphic, UMain, SysUtils, TypInfo; function TScreenOptionsGraphics.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; begin @@ -48,7 +48,7 @@ begin { if SelInteraction <= 1 then begin Restart := true; end;} - if SelInteraction = 5 then begin + if SelInteraction = 6 then begin Ini.Save; AudioPlayback.PlaySound(SoundLib.Back); // FIXME: changing the video mode does not work this way in windows @@ -66,14 +66,14 @@ begin InteractPrev; SDLK_RIGHT: begin - if (SelInteraction >= 0) and (SelInteraction <= 4) then begin + if (SelInteraction >= 0) and (SelInteraction < 6) then begin AudioPlayback.PlaySound(SoundLib.Option); InteractInc; end; end; SDLK_LEFT: begin - if (SelInteraction >= 0) and (SelInteraction <= 4) then begin + if (SelInteraction >= 0) and (SelInteraction < 6) then begin AudioPlayback.PlaySound(SoundLib.Option); InteractDec; end; @@ -87,12 +87,12 @@ constructor TScreenOptionsGraphics.Create; // I: integer; // Auto Removed, Unused Variable begin inherited Create; - LoadFromTheme(Theme.OptionsGraphics); AddSelectSlide(Theme.OptionsGraphics.SelectResolution, Ini.Resolution, IResolution); AddSelectSlide(Theme.OptionsGraphics.SelectFullscreen, Ini.Fullscreen, IFullscreen); - AddSelectSlide(Theme.OptionsGraphics.SelectDepth, Ini.Depth, IDepth); + AddSelectSlide(Theme.OptionsGraphics.SelectDepth, Ini.Depth, IDepth); + AddSelectSlide(Theme.OptionsGraphics.SelectVisualizer, Ini.VisualizerOption, IVisualizer); AddSelectSlide(Theme.OptionsGraphics.SelectOscilloscope, Ini.Oscilloscope, IOscilloscope); AddSelectSlide(Theme.OptionsGraphics.SelectMovieSize, Ini.MovieSize, IMovieSize); diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 8edd2be4..911d122e 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -423,23 +423,38 @@ begin // reset video playback engine, to play video clip... fCurrentVideoPlaybackEngine.Close; fCurrentVideoPlaybackEngine := VideoPlayback; - - // set movie +{** + * == Background == + * We have four types of backgrounds: + * + Blank : Nothing has been set, this is our fallback + * + Picture : Picture has been set, and exists - otherwise we fallback + * + Video : Video has been set, and exists - otherwise we fallback + * + Visualization: + Off : No Visialization + * + WhenNoVideo: Overwrites Blank and Picture + * + On : Overwrites Blank, Picture and Video + *} +{** + * set background to: video + *} CurrentSong.VideoLoaded := False; fShowVisualization := False; if (CurrentSong.Video <> '') and FileExists(CurrentSong.Path + CurrentSong.Video) then - //and not (TVisualizerOption(Ini.VisualizerOption) in [voOn, voWhenNoVideo]) then begin if (fCurrentVideoPlaybackEngine.Open(CurrentSong.Path + CurrentSong.Video)) then begin + fShowVisualization := False; + fCurrentVideoPlaybackEngine := VideoPlayback; fCurrentVideoPlaybackEngine.Position := CurrentSong.VideoGAP + CurrentSong.Start; CurrentSong.VideoLoaded := True; + fCurrentVideoPlaybackEngine.play; end; end; - // set background - if (CurrentSong.Background <> '') and (CurrentSong.VideoLoaded = False) then - //and (TVisualizerOption(Ini.VisualizerOption) = voOff) then +{** + * set background to: picture + *} + if (CurrentSong.Background <> '') and (CurrentSong.VideoLoaded = False) + and (TVisualizerOption(Ini.VisualizerOption) = voOff) then try Tex_Background := Texture.LoadTexture(CurrentSong.Path + CurrentSong.Background); except @@ -449,17 +464,27 @@ begin end else Tex_Background.TexNum := 0; - {** - * set visualization - *} - {* - if (TVisualizerOption(Ini.VisualizerOption) in [voOn, voWhenNoVideo]) then +{** + * set background to: visualization (Overwrites all) + *} + if (TVisualizerOption(Ini.VisualizerOption) in [voOn]) then + begin + fShowVisualization := True; + fCurrentVideoPlaybackEngine := Visualization; + fCurrentVideoPlaybackEngine.play; + end; + +{** + * set background to: visualization (Videos are still shown) + *} + if ((TVisualizerOption(Ini.VisualizerOption) in [voWhenNoVideo]) and + (CurrentSong.VideoLoaded = False)) then begin fShowVisualization := True; fCurrentVideoPlaybackEngine := Visualization; fCurrentVideoPlaybackEngine.play; end; - *} + // prepare lyrics timer LyricsState.Reset(); LyricsState.SetCurrentTime(CurrentSong.Start); -- cgit v1.2.3