From 58a47541955f5010269d72a06e307bbb945211ea Mon Sep 17 00:00:00 2001 From: brunzelchen Date: Fri, 9 Apr 2010 19:15:09 +0000 Subject: - added missing files for iStar Theme - added shuffle mode for song menu (random song preview when user idles for some time) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/1.0.1 Challenge MOD@2225 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UIni.pas | 35 +++++-- Game/Code/Classes/UThemes.pas | 2 + Game/Code/Screens/UScreenOptionsGame.pas | 7 +- Game/Code/Screens/UScreenSong.pas | 157 +++++++++++++++++++++++++++++-- Game/Code/UltraStar.dpr | 2 +- 5 files changed, 182 insertions(+), 21 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UIni.pas b/Game/Code/Classes/UIni.pas index 37258a44..048f1496 100644 --- a/Game/Code/Classes/UIni.pas +++ b/Game/Code/Classes/UIni.pas @@ -21,6 +21,7 @@ type Tabs: integer; Tabs_at_startup:integer; //Tabs at Startup fix Sorting: integer; + ShuffleTime: integer; Debug: integer; LoadFaultySongs:integer; NewPartyPoints: integer; @@ -121,6 +122,17 @@ const sTitle2 = 6; sArtist2 = 7; + IShuffleTime: array[0..9] of string = ('Off', + '15 Sec', + '30 Sec', + '45 Sec', + '60 Sec', + '75 Sec', + '90 Sec', + '105 Sec', + '120 Sec', + 'MAX'); + IDebug: array[0..1] of string = ('Off', 'On'); ILoadFaultySongs: array[0..1] of string = ('Off', 'On'); INewPartyPoints: array[0..1] of string = ('Off', 'On'); @@ -161,12 +173,12 @@ const // Advanced ILoadAnimation: array[0..1] of string = ('Off', 'On'); IEffectSing: array[0..1] of string = ('Off', 'On'); - IScreenFade: array [0..1] of String =('Off', 'On'); + IScreenFade: array [0..1] of String =('Off', 'On'); IAskbeforeDel: array[0..1] of string = ('Off', 'On'); IOnSongClick: array[0..2] of string = ('Sing', 'Select Players', 'Open Menu'); - ILineBonus: array[0..2] of string = ('Off', 'At Score', 'At Notes'); - IPartyPopup: array[0..1] of string = ('Off', 'On'); - ISumPlayers: array[0..2] of string = ('Never', 'Dynamic', 'Always'); + ILineBonus: array[0..2] of string = ('Off', 'At Score', 'At Notes'); + IPartyPopup: array[0..1] of string = ('Off', 'On'); + ISumPlayers: array[0..2] of string = ('Never', 'Dynamic', 'Always'); IJoypad: array[0..1] of string = ('Off', 'On'); ILPT: array[0..2] of string = ('Off', 'LCD', 'Lights'); @@ -249,6 +261,11 @@ begin for Pet := 0 to High(ISorting) do if Tekst = ISorting[Pet] then Ini.Sorting := Pet; + // ShuffleTime + Tekst := IniFile.ReadString('Game', 'ShuffleTime', 'Off'); + for Pet := 0 to High(IShuffleTime) do + if Tekst = IShuffleTime[Pet] then Ini.ShuffleTime := Pet; + // Debug Tekst := IniFile.ReadString('Game', 'Debug', IDebug[0]); for Pet := 0 to High(IDebug) do @@ -410,7 +427,7 @@ begin if Tekst = IPreviewFading[Pet] then Ini.PreviewFading := Pet; // Lyrics Font - Tekst := IniFile.ReadString('Lyrics', 'LyricsFont', ILyricsFont[1]); + Tekst := IniFile.ReadString('Lyrics', 'LyricsFont', ILyricsFont[2]); for Pet := 0 to High(ILyricsFont) do if Tekst = ILyricsFont[Pet] then Ini.LyricsFont := Pet; @@ -442,7 +459,7 @@ begin ThemeIni.Free; //if Default Theme then save Themeno to I2 - if (Tekst = 'Blue Sensation') then + if (Tekst = 'BLUE SENSATION') then I2 := I; //Search for Skins for this Theme @@ -644,6 +661,10 @@ begin Tekst := ISorting[Ini.Sorting]; IniFile.WriteString('Game', 'Sorting', Tekst); + //ShuffleTime + Tekst := IShuffleTime[Ini.ShuffleTime]; + IniFile.WriteString('Game', 'ShuffleTime', Tekst); + // Debug Tekst := IDebug[Ini.Debug]; IniFile.WriteString('Game', 'Debug', Tekst); @@ -808,7 +829,7 @@ begin Tekst := IPartyPopup[Ini.PartyPopup]; IniFile.WriteString('Advanced', 'PartyPopup', Tekst); - //Party SumPlayers + //SumPlayers Tekst := ISumPlayers[Ini.SumPlayers]; IniFile.WriteString('Advanced', 'SumPlayers', Tekst); diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index 05c6575a..dd90987d 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -456,6 +456,7 @@ type SelectLanguage: TThemeSelectSlide; SelectTabs: TThemeSelect; SelectSorting: TThemeSelectSlide; + SelectShuffleTime: TThemeSelectSlide; SelectDebug: TThemeSelect; ButtonExit: TThemeButton; end; @@ -1345,6 +1346,7 @@ begin ThemeLoadSelectSlide(OptionsGame.SelectLanguage, 'OptionsGameSelectSlideLanguage'); ThemeLoadSelect(OptionsGame.SelectTabs, 'OptionsGameSelectTabs'); ThemeLoadSelectSlide(OptionsGame.SelectSorting, 'OptionsGameSelectSlideSorting'); + ThemeLoadSelectSlide(OptionsGame.SelectShuffleTime, 'OptionsGameSelectShuffleTime'); ThemeLoadSelect(OptionsGame.SelectDebug, 'OptionsGameSelectDebug'); ThemeLoadButton(OptionsGame.ButtonExit, 'OptionsGameButtonExit'); diff --git a/Game/Code/Screens/UScreenOptionsGame.pas b/Game/Code/Screens/UScreenOptionsGame.pas index 8aadb27a..c9268931 100644 --- a/Game/Code/Screens/UScreenOptionsGame.pas +++ b/Game/Code/Screens/UScreenOptionsGame.pas @@ -46,7 +46,7 @@ begin end; SDLK_RETURN: begin - if SelInteraction = 6 then begin + if SelInteraction = 7 then begin Music.PlayBack; RefreshSongs; FadeTo(@ScreenOptions); @@ -58,14 +58,14 @@ begin InteractPrev; SDLK_RIGHT: begin - if (SelInteraction >= 0) and (SelInteraction <= 5) then begin + if (SelInteraction >= 0) and (SelInteraction <= 6) then begin Music.PlayOption; InteractInc; end; end; SDLK_LEFT: begin - if (SelInteraction >= 0) and (SelInteraction <= 5) then begin + if (SelInteraction >= 0) and (SelInteraction <= 6) then begin Music.PlayOption; InteractDec; end; @@ -91,6 +91,7 @@ begin AddSelectSlide(Theme.OptionsGame.SelectLanguage, Ini.Language, ILanguage); AddSelect(Theme.OptionsGame.SelectTabs, Ini.Tabs, ITabs); AddSelectSlide(Theme.OptionsGame.SelectSorting, Ini.Sorting, ISorting); + AddSelectSlide(Theme.OptionsGame.SelectShuffleTime, Ini.ShuffleTime, IShuffleTime); AddSelect(Theme.OptionsGame.SelectDebug, Ini.Debug, IDebug); diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 377106d4..8516c012 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -12,8 +12,11 @@ type TVidVis = (none, windowed, full); THandler = record - changed: boolean; + changed: boolean; change_time: real; + lastIndex: integer; + lastCat: integer; + active: boolean; end; TScreenSong = class(TMenu) @@ -53,6 +56,9 @@ type //VideoAspect AspectHandler: THandler; + //Wait timer + WaitHandler: THandler; + //Medley Icons MedleyIcon: cardinal; CalcMedleyIcon: cardinal; @@ -353,6 +359,44 @@ begin If (PressedDown) Then begin // Key Down + if (WaitHandler.active) and not (PressedKey = SDLK_RETURN) then + begin + if (Ini.Tabs_at_startup=1) then + begin + //Search Cat + for I := WaitHandler.lastIndex downto low(CatSongs.Song) do + begin + if CatSongs.Song[I].Main then + break; + end; + + //Choose Cat + CatSongs.ShowCategoryList; + ShowCatTL (I); + + CatSongs.ClickCategoryButton(I); + end; + + //Choose Song + SkipTo2(WaitHandler.lastIndex); + + + ChangeMusic; + SetScroll4; + end; + + if (Mode = smNormal) and not MakeMedley and (Ini.ShuffleTime>0) then + begin + WaitHandler.changed := true; + WaitHandler.change_time := 0; + if (WaitHandler.active) then + begin + WaitHandler.active := false; + if (PressedKey<>SDLK_RETURN) then + Exit; + end; + end; + SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT); @@ -829,7 +873,7 @@ begin if (Mode = smNormal) then OpenEditor; end; - + SDLK_R: begin if (Length(Songs.Song) > 0) and (Mode = smNormal) then @@ -1960,6 +2004,14 @@ begin SetJoker; SetStatics; + + if (Mode = smNormal) and (Ini.ShuffleTime>0) then + begin + WaitHandler.changed := true; + WaitHandler.change_time := 0; + end; + + WaitHandler.active := false; end; procedure TScreenSong.RandomSongChallenge(); @@ -2034,11 +2086,13 @@ end; function TScreenSong.Draw: boolean; var - dx: real; - dt: real; - I, J: Integer; + dx: real; + dt: real; + I, I2, J: Integer; Window: TRectCoords; - Blend: real; + Blend: real; + VisArr: array of integer; + begin dx := SongTarget-SongCurrent; dt := TimeSkip*7; @@ -2239,7 +2293,89 @@ begin Static[StaticTop].Visible := false; end; - + + if (Mode = smNormal) and (Ini.ShuffleTime>0) and + not MakeMedley and not CatSongs.Song[Interaction].Main and + (Length(CatSongs.Song)-CatSongs.CatCount>1) then + begin + if (WaitHandler.changed and + (((Ini.ShuffleTime<9) and (WaitHandler.change_time + TimeSkip>Ini.ShuffleTime*15)) + or (Music.Finished))) then + begin + WaitHandler.change_time := 0; + if (not WaitHandler.active) then + begin + WaitHandler.active := true; + WaitHandler.lastIndex := Interaction; + WaitHandler.lastCat := CatSongs.CatNumShow; + end; + + if(Ini.Tabs_at_startup<>1) then + begin + //Random in one Category + SetLength(VisArr, 0); + + for I := 0 to Length(CatSongs.Song) - 1 do + begin + if CatSongs.Song[I].Visible and not (I=Interaction)then + begin + SetLength(VisArr, Length(VisArr)+1); + VisArr[Length(VisArr)-1] := I; + end; + end; + + if (Length(VisArr)>0) then + begin + I := Random(Length(VisArr)); + I := VisArr[I]; + + //Choose Song + SkipTo2(I); + end; + end else + begin + //random in All Categorys + SetLength(VisArr, 0); + + for I := 0 to Length(CatSongs.Song) - 1 do + begin + if not CatSongs.Song[I].Main and (I<>Interaction)then + begin + SetLength(VisArr, Length(VisArr)+1); + VisArr[Length(VisArr)-1] := I; + end; + end; + + if (Length(VisArr)>0) then + begin + I2 := Random(Length(VisArr)); + I2 := VisArr[I2]; + + //Search Cat + for I := I2 downto low(CatSongs.Song) do + begin + if CatSongs.Song[I].Main then + break; + end; + + //Choose Cat + CatSongs.ShowCategoryList; + ShowCatTL (I); + + CatSongs.ClickCategoryButton(I); + + //Choose Song + SkipTo2(I2); + end; + end; + + Music.PlayChange; + ChangeMusic; + SetScroll4; + end else + WaitHandler.change_time := WaitHandler.change_time + TimeSkip; + end; + DrawExtensions; end; @@ -2389,11 +2525,11 @@ begin end; procedure TScreenSong.UpdateLCD; -begin +begin{ LCD.HideCursor; LCD.Clear; LCD.WriteText(1, Text[TextArtist].Text); - LCD.WriteText(2, Text[TextTitle].Text); + LCD.WriteText(2, Text[TextTitle].Text); } end; //Procedure Change current played Preview @@ -3120,6 +3256,7 @@ end; procedure TScreenSong.StartSong; begin + WaitHandler.changed := false; CatSongs.Selected := Interaction; Music.Stop; //Party Mode @@ -3218,7 +3355,7 @@ end; procedure TScreenSong.UnLoadDetailedCover; begin CoverTime := 0; - + Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', true); // 0.5.0: show cached texture Button[Interaction].Texture2.Alpha := 0; diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index 056f2f78..d822cdb1 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -124,7 +124,7 @@ uses acinerella in 'lib\acinerella\acinerella.pas'; const - Version = 'UltraStar Deluxe v1.0.1a Challenge-MOD r7b beta 5 2010-04-07'; + Version = 'UltraStar Deluxe v1.0.1a Challenge-MOD r7b beta 7 2010-04-09'; var WndTitle: string; -- cgit v1.2.3