From 09cb93c06202febc160b644b384a8d7d29978c04 Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Sat, 23 Feb 2013 15:47:29 +0000 Subject: medley mod: Themes modifications. This is considered the last part of the medley mod. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2946 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/base/TextGL.pas | 28 +++++++++++++++++++++++----- src/base/UThemes.pas | 26 +++++++++++++++++++++++--- src/screens/UScreenScore.pas | 13 +++++++++++++ src/screens/UScreenSing.pas | 27 +++++++++++++++++++++------ src/screens/UScreenSong.pas | 27 ++++++++++++--------------- 5 files changed, 92 insertions(+), 29 deletions(-) (limited to 'src') diff --git a/src/base/TextGL.pas b/src/base/TextGL.pas index feca0974..7da1d558 100644 --- a/src/base/TextGL.pas +++ b/src/base/TextGL.pas @@ -56,6 +56,7 @@ const ftBold = 1; ftOutline1 = 2; ftOutline2 = 3; + ftBoldHighRes = 4; var Fonts: array of TGLFont; @@ -98,7 +99,7 @@ procedure AddFontFallbacks(FontIni: TMemIniFile; Font: TFont); var FallbackFont: IPath; IdentName: string; - I: Integer; + I: integer; begin // evaluate the ini-file's 'Fallbacks' section for I := 1 to 10 do @@ -117,8 +118,8 @@ begin end; const - FONT_NAMES: array [0..3] of string = ( - 'Normal', 'Bold', 'Outline1', 'Outline2' + FONT_NAMES: array [0..4] of string = ( + 'Normal', 'Bold', 'Outline1', 'Outline2', 'BoldHighRes' ); procedure BuildFonts; @@ -126,6 +127,8 @@ var I: integer; FontIni: TMemIniFile; FontFile: IPath; + FontMaxResolution: integer; + FontPreCache: integer; Outline: single; Embolden: single; OutlineFont: TFTScalableOutlineFont; @@ -144,12 +147,21 @@ begin FontFile := FindFontFile(FontIni.ReadString(SectionName , 'File', '')); + FontMaxResolution := FontIni.ReadInteger(SectionName, 'MaxResolution', 64); + FontPreCache := FontIni.ReadInteger(SectionName, 'PreCache', 1); + // create either outlined or normal font Outline := FontIni.ReadFloat(SectionName, 'Outline', 0.0); if (Outline > 0.0) then begin // outlined font - OutlineFont := TFTScalableOutlineFont.Create(FontFile, 64, Outline, True, True); + OutlineFont := TFTScalableOutlineFont.Create( + FontFile, + FontMaxResolution, + Outline, + True, + (FontPreCache <> 0) + ); OutlineFont.SetOutlineColor( FontIni.ReadFloat(SectionName, 'OutlineColorR', 0.0), FontIni.ReadFloat(SectionName, 'OutlineColorG', 0.0), @@ -163,7 +175,13 @@ begin begin // normal font Embolden := FontIni.ReadFloat(SectionName, 'Embolden', 0.0); - Fonts[I].Font := TFTScalableFont.Create(FontFile, 64, Embolden, True, True); + Fonts[I].Font := TFTScalableFont.Create( + FontFile, + FontMaxResolution, + Embolden, + True, + (FontPreCache <> 0) + ); Fonts[I].Outlined := false; end; diff --git a/src/base/UThemes.pas b/src/base/UThemes.pas index b385406f..7dd30f7f 100644 --- a/src/base/UThemes.pas +++ b/src/base/UThemes.pas @@ -34,12 +34,12 @@ interface {$I switches.inc} uses - IniFiles, SysUtils, Classes, + IniFiles, ULog, - UTexture, - UPath; + UPath, + UTexture; type TRGB = record @@ -261,6 +261,10 @@ type //Video Icon Mod VideoIcon: TThemeStatic; + //Medley Icons + MedleyIcon: TThemeStatic; + CalculatedMedleyIcon: TThemeStatic; + //Show Cat in TopLeft Mod TextCat: TThemeText; StaticCat: TThemeStatic; @@ -356,6 +360,9 @@ type TextP3R: TThemeText; TextP3RScore: TThemeText; + StaticSongName: TThemeStatic; + TextSongName: TThemeText; + //Linebonus Translations LineBonusText: array [0..8] of UTF8String; @@ -401,6 +408,9 @@ type StaticLevelRound: array[1..6] of TThemeStatic; StaticPlayerIdBox: array[1..6] of TThemeStatic; + StaticNavigate: TThemeStatic; + TextNavigate: TThemeText; + // Description: array[0..5] of string;} end; @@ -1087,6 +1097,10 @@ begin //Video Icon Mod ThemeLoadStatic(Song.VideoIcon, 'SongVideoIcon'); + //Medley Icons + ThemeLoadStatic(Song.MedleyIcon, 'SongMedleyIcon'); + ThemeLoadStatic(Song.CalculatedMedleyIcon, 'SongCalculatedMedleyIcon'); + //Show Cat in TopLeft Mod ThemeLoadStatic(Song.StaticCat, 'SongStaticCat'); ThemeLoadText(Song.TextCat, 'SongTextCat'); @@ -1210,6 +1224,9 @@ begin ThemeLoadStatic(Sing.StaticP3RScoreBG, 'SingP3RStatic2'); ThemeLoadText(Sing.TextP3RScore, 'SingP3RTextScore'); + ThemeLoadStatic(Sing.StaticSongName, 'SingSongNameStatic'); + ThemeLoadText(Sing.TextSongName, 'SingSongNameText'); + //Line Bonus Texts Sing.LineBonusText[0] := Language.Translate('POPUP_AWFUL'); Sing.LineBonusText[1] := Sing.LineBonusText[0]; @@ -1260,6 +1277,9 @@ begin ThemeLoadStatic(Score.StaticRatings[I], 'ScoreStaticRatingPicture' + IntToStr(I)); end; + ThemeLoadStatic(Score.StaticNavigate, 'ScoreStaticNavigate'); + ThemeLoadText(Score.TextNavigate, 'ScoreTextNavigate'); + // Top5 ThemeLoadBasic(Top5, 'Top5'); diff --git a/src/screens/UScreenScore.pas b/src/screens/UScreenScore.pas index 4b7332b4..82b73ea2 100644 --- a/src/screens/UScreenScore.pas +++ b/src/screens/UScreenScore.pas @@ -168,6 +168,8 @@ type TextGolden_ActualValue: array[1..6] of integer; ActualRound: integer; + StaticNavigate: integer; + TextNavigate: integer; procedure RefreshTexts; procedure ResetScores; @@ -577,6 +579,9 @@ begin aPlayerScoreScreenTextures[Player].Player_Id_Box := Texture.GetTexture(Skin.GetTextureFileName('PlayerIDBox0' + IntToStr(Player)), Texture_Type_Transparent); end; + StaticNavigate := AddStatic(Theme.Score.StaticNavigate); + TextNavigate := AddText(Theme.Score.TextNavigate); + LoadSwapTextures; end; @@ -701,6 +706,14 @@ begin begin for P := 0 to PlayersPlay - 1 do Player[P] := PlaylistMedley.Stats[ActualRound].Player[P]; + + Statics[StaticNavigate].Visible := true; + Text[TextNavigate].Visible := true; + end + else + begin + Statics[StaticNavigate].Visible := false; + Text[TextNavigate].Visible := false; end; MapPlayersToPosition; diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index 13350511..581e22a0 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -123,6 +123,9 @@ type StaticPausePopup: integer; + SongNameStatic: integer; + SongNameText: integer; + Tex_Background: TTexture; FadeOut: boolean; Lyrics: TLyricEngine; @@ -142,6 +145,7 @@ type PlayerEnabled: integer; //< defines whether a player can score atm end; + procedure ClearSettings; procedure ApplySettings; //< applies changes of settings record procedure EndSong; @@ -370,6 +374,9 @@ begin fLyricsSync := TLyricsSyncSource.Create(); fMusicSync := TMusicSyncSource.Create(); + SongNameStatic := AddStatic(Theme.Sing.StaticSongName);; + SongNameText := AddText(Theme.Sing.TextSongName); + eSongLoaded := THookableEvent.Create('ScreenSing.SongLoaded'); ClearSettings; @@ -412,8 +419,8 @@ begin else fTimebarMode := tbmCurrent; - // prepare players - SetLength(Player, PlayersPlay); + Statics[SongNameStatic].Visible := false; + Text[SongNameText].Visible := false; case PlayersPlay of 1: @@ -768,11 +775,10 @@ begin begin CurrentSong.SetMedleyMode(); -{ ** ToDo Text[SongNameText].Text := IntToStr(PlaylistMedley.CurrentMedleySong) + '/' + IntToStr(PlaylistMedley.NumMedleySongs) + ': ' + CurrentSong.Artist + ' - ' + CurrentSong.Title; -} + //medley start and end timestamps StartNote := FindNote(CurrentSong.Medley.StartBeat - round(CurrentSong.BPM[0].BPM*CurrentSong.Medley.FadeIn_time / 60)); MedleyStart := GetTimeFromBeat(Lines[0].Line[StartNote.line].Note[0].Start); @@ -1452,13 +1458,16 @@ var begin if AudioPlayback.Position < GetTimeFromBeat(CurrentSong.Medley.StartBeat) then begin - timeDiff := GetTimeFromBeat(CurrentSong.Medley.StartBeat)-AudioPlayback.Position+1; + Statics[SongNameStatic].Visible := true; + Text[SongNameText].Visible := true; + + timeDiff := GetTimeFromBeat(CurrentSong.Medley.StartBeat) - AudioPlayback.Position + 1; t := frac(timeDiff); glColor4f(0.15, 0.30, 0.6, t); h := 300 * t * ScreenH / RenderH; - SetFontStyle(ftBold); + SetFontStyle(ftBoldHighRes); SetFontItalic(false); SetFontSize(h); CountDownText := IntToStr(round(timeDiff - t)); @@ -1466,7 +1475,13 @@ begin SetFontPos (RenderW / 2 - w / 2, RenderH / 2 - h / 2); glPrint(PChar(CountDownText)); + end + else + begin + Statics[SongNameStatic].Visible := false; + Text[SongNameText].Visible := false; end; end; +end; end. diff --git a/src/screens/UScreenSong.pas b/src/screens/UScreenSong.pas index 7558a59b..50efd792 100644 --- a/src/screens/UScreenSong.pas +++ b/src/screens/UScreenSong.pas @@ -78,6 +78,10 @@ type //Video Icon Mod VideoIcon: cardinal; + //Medley Icons + MedleyIcon: cardinal; + CalcMedleyIcon: cardinal; + TextCat: integer; StaticCat: integer; @@ -425,13 +429,6 @@ begin Ord('S'): begin - Log.LogError('SDL_ModState: ' + inttostr(SDL_ModState)); - Log.LogError('KMOD_LSHIFT: ' + inttostr(KMOD_LSHIFT)); - Log.LogError('CatSongs.Song[Interaction].Medley.Source: ' + inttostr(ord(CatSongs.Song[Interaction].Medley.Source))); - Log.LogError('msCalculated: ' + inttostr(ord(msCalculated))); - Log.LogError('msTag: ' + inttostr(ord(msTag))); - Log.LogError('Mode: ' + inttostr(ord(Mode))); - Log.LogError('smNormal: ' + inttostr(ord(smNormal))); if //(SDL_ModState = KMOD_LSHIFT) and (CatSongs.Song[Interaction].Medley.Source >= msCalculated) and (Mode = smNormal) then StartMedley(0, msCalculated) @@ -441,14 +438,6 @@ begin Ord('D'): begin - Log.LogError('SDL_ModState: ' + inttostr(SDL_ModState)); - Log.LogError('KMOD_LSHIFT: ' + inttostr(KMOD_LSHIFT)); - Log.LogError('length(getVisibleMedleyArr(msCalculated)): ' + inttostr(length(getVisibleMedleyArr(msCalculated)))); - Log.LogError('msCalculated: ' + inttostr(ord(msCalculated))); - Log.LogError('msTag: ' + inttostr(ord(msTag))); - Log.LogError('Length(getVisibleMedleyArr(msTag)): ' + inttostr(Length(getVisibleMedleyArr(msTag)))); - Log.LogError('smNormal: ' + inttostr(ord(smNormal))); - Log.LogError('Mode: ' + inttostr(ord(Mode))); if (Mode = smNormal) and //(SDL_ModState = KMOD_LSHIFT) and (length(getVisibleMedleyArr(msCalculated)) > 0) then StartMedley(5, msCalculated) @@ -881,6 +870,10 @@ begin //Show Video Icon Mod VideoIcon := AddStatic(Theme.Song.VideoIcon); + //Medley Icons + MedleyIcon := AddStatic(Theme.Song.MedleyIcon); + CalcMedleyIcon := AddStatic(Theme.Song.CalculatedMedleyIcon); + //Party Mode StaticTeam1Joker1 := AddStatic(Theme.Song.StaticTeam1Joker1); StaticTeam1Joker2 := AddStatic(Theme.Song.StaticTeam1Joker2); @@ -1042,6 +1035,10 @@ begin // Set visibility of video icon Statics[VideoIcon].Visible := CatSongs.Song[Interaction].Video.IsSet; + // Set visibility of medley icons + Statics[MedleyIcon].Visible := (CatSongs.Song[Interaction].Medley.Source = msTag); + Statics[CalcMedleyIcon].Visible := (CatSongs.Song[Interaction].Medley.Source = msCalculated); + // Set texts Text[TextArtist].Text := CatSongs.Song[Interaction].Artist; Text[TextTitle].Text := CatSongs.Song[Interaction].Title; -- cgit v1.2.3