From f76443329ab6d536326080d14f5565f066ca433f Mon Sep 17 00:00:00 2001 From: brunzelchen Date: Mon, 1 Mar 2010 19:32:49 +0000 Subject: summerizing of highscores in top screen as an option (never, dynamic, always); top 3 in song menu; ctrl+print for jpg screenshots; git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/1.0.1 Challenge MOD@2164 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UDataBase.pas | 47 +++++++++++++++---- Game/Code/Classes/UIni.pas | 10 +++++ Game/Code/Classes/UMain.pas | 5 ++- Game/Code/Classes/UThemes.pas | 9 ++++ Game/Code/Menu/UDisplay.pas | 2 +- Game/Code/Screens/UScreenOptionsAdvanced.pas | 7 +-- Game/Code/Screens/UScreenSong.pas | 67 ++++++++++++++++++++++++++++ Game/Code/Screens/UScreenTop.pas | 4 +- Game/Code/UltraStar.dpr | 2 +- Game/Output/Languages/English.ini | 4 ++ Game/Output/Languages/German.ini | 4 ++ Game/Output/Languages/Italian.ini | 4 ++ Game/Output/Themes/Deluxe.ini | 61 ++++++++++++++++++++++++- 13 files changed, 209 insertions(+), 17 deletions(-) diff --git a/Game/Code/Classes/UDataBase.pas b/Game/Code/Classes/UDataBase.pas index 580f7144..8e05475d 100644 --- a/Game/Code/Classes/UDataBase.pas +++ b/Game/Code/Classes/UDataBase.pas @@ -47,7 +47,7 @@ type Destructor Free; Procedure Init(const Filename: string); - procedure ReadScore(var Song: TSong); + procedure ReadScore(var Song: TSong; max, sum: integer); procedure AddScore(var Song: TSong; Level: integer; Name: string; Score: integer; TimeStamp: integer); procedure WriteScore(var Song: TSong); @@ -248,20 +248,48 @@ end; //-------------------- //ReadScore - Read Scores into SongArray +// +//sum: +// 0=never +// 1=only, if more then max entries (dynamic) +// 2=always //-------------------- -procedure TDataBaseSystem.ReadScore(var Song: TSong); +procedure TDataBaseSystem.ReadScore(var Song: TSong; max, sum: integer); var - TableData: TSqliteTable; - Difficulty: Byte; - I: integer; + TableData: TSqliteTable; + Difficulty: Byte; + I: integer; PlayerListed: boolean; - DateStr: string; + DateStr: string; + num: array[0..2] of integer; //num entries easy, medium, hard begin if not Assigned(ScoreDB) then Exit; try + //count num entries + if(sum=1) then + begin + num[0] := ScoreDB.GetTableValue('SELECT COUNT(`SongID`) FROM `US_Scores` '+ + 'WHERE `Difficulty` = 0 and '+ + '`SongID` = (SELECT `ID` FROM `us_songs` WHERE `Artist` = "' + + Song.Artist + '" AND `Title` = "' + Song.Title + + '" LIMIT 1);'); + + num[1] := ScoreDB.GetTableValue('SELECT COUNT(`SongID`) FROM `US_Scores` '+ + 'WHERE `Difficulty` = 1 and '+ + '`SongID` = (SELECT `ID` FROM `us_songs` WHERE `Artist` = "' + + Song.Artist + '" AND `Title` = "' + Song.Title + + '" LIMIT 1);'); + + num[2] := ScoreDB.GetTableValue('SELECT COUNT(`SongID`) FROM `US_Scores` '+ + 'WHERE `Difficulty` = 2 and '+ + '`SongID` = (SELECT `ID` FROM `us_songs` WHERE `Artist` = "' + + Song.Artist + '" AND `Title` = "' + Song.Title + + '" LIMIT 1);'); + end; + //Search Song in DB TableData := ScoreDB.GetTable('SELECT `Difficulty`, `Player`, `Score`, `Date` '+ 'FROM `us_scores` WHERE '+ @@ -279,7 +307,7 @@ begin // Add one Entry to Array Difficulty := StrToInt(TableData.FieldAsString(TableData.FieldIndex['Difficulty'])); if ((Difficulty >= 0) and (Difficulty <= 2)) and - (Length(Song.Score[Difficulty]) < 8) then + (Length(Song.Score[Difficulty]) < max) then begin //filter player PlayerListed:=false; @@ -295,7 +323,10 @@ begin end; end; - if not PlayerListed then + if (sum=0) or + ((sum=1) and (num[Difficulty]<=max)) or + ((sum=1) and (num[Difficulty]>max) and not PlayerListed) or + ((sum=2) and not PlayerListed) then begin SetLength(Song.Score[Difficulty], Length(Song.Score[Difficulty]) + 1); diff --git a/Game/Code/Classes/UIni.pas b/Game/Code/Classes/UIni.pas index 02b9c5ef..da0d0bea 100644 --- a/Game/Code/Classes/UIni.pas +++ b/Game/Code/Classes/UIni.pas @@ -77,6 +77,7 @@ type OnSongClick: integer; LineBonus: integer; PartyPopup: integer; + SumPlayers: integer; // Controller Joypad: integer; @@ -161,6 +162,7 @@ const 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'); IJoypad: array[0..1] of string = ('Off', 'On'); ILPT: array[0..2] of string = ('Off', 'LCD', 'Lights'); @@ -565,6 +567,10 @@ begin for Pet := 0 to High(IPartyPopup) do if Tekst = IPartyPopup[Pet] then Ini.PartyPopup := Pet; + // SumPlayers + Tekst := IniFile.ReadString('Advanced', 'SumPlayers', 'Dynamic'); + for Pet := 0 to High(ISumPlayers) do + if Tekst = ISumPlayers[Pet] then Ini.SumPlayers := Pet; // Joypad Tekst := IniFile.ReadString('Controller', 'Joypad', IJoypad[0]); @@ -780,6 +786,10 @@ begin Tekst := IPartyPopup[Ini.PartyPopup]; IniFile.WriteString('Advanced', 'PartyPopup', Tekst); + //Party SumPlayers + Tekst := ISumPlayers[Ini.SumPlayers]; + IniFile.WriteString('Advanced', 'SumPlayers', Tekst); + // Joypad Tekst := IJoypad[Ini.Joypad]; IniFile.WriteString('Controller', 'Joypad', Tekst); diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas index 795f2241..cb70cd08 100644 --- a/Game/Code/Classes/UMain.pas +++ b/Game/Code/Classes/UMain.pas @@ -188,7 +188,10 @@ Begin if (Event.key.keysym.sym = SDLK_SYSREQ) or (Event.key.keysym.sym = SDLK_PRINT) then begin // ScreenPopupError.ShowPopup('How dare you press the key'); //show error message - Display.ScreenShot; + if (SDL_GetModState and KMOD_LCTRL = KMOD_LCTRL) then + Display.PrintScreen //jpeg + else + Display.ScreenShot; //bmp end // popup hack... if there is a visible popup then let it handle input instead of underlying screen // shoud be done in a way to be sure the topmost popup has preference (maybe error, then check) diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index 0b1eb484..05c6575a 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -255,6 +255,8 @@ type TextP2: TThemeText; TextMedley: array[1..4] of TThemeText; + TextTop: array[0..2] of TThemeText; + StaticTop: TThemeStatic; //Video Icon Mod VideoIcon: TThemeStatic; @@ -510,6 +512,7 @@ type SelectAskbeforeDel: TThemeSelect; SelectOnSongClick: TThemeSelectSlide; SelectPartyPopup: TThemeSelect; + SelectSumPlayers: TThemeSelect; ButtonExit: TThemeButton; end; @@ -1086,6 +1089,11 @@ begin for I := 1 to 4 do ThemeLoadText(Song.TextMedley[I], 'SongTextMedley' + IntToStr(I)); + for I := 0 to 2 do + ThemeLoadText(Song.TextTop[I], 'SongTextTop' + IntToStr(I+1)); + + ThemeLoadStatic(Song.StaticTop, 'SongStaticTop'); + //Video Icon Mod ThemeLoadStatic(Song.VideoIcon, 'SongVideoIcon'); @@ -1400,6 +1408,7 @@ begin ThemeLoadSelectSlide (OptionsAdvanced.SelectOnSongClick, 'OptionsAdvancedSelectSlideOnSongClick'); ThemeLoadSelect (OptionsAdvanced.SelectAskbeforeDel, 'OptionsAdvancedSelectAskbeforeDel'); ThemeLoadSelect (OptionsAdvanced.SelectPartyPopup, 'OptionsAdvancedSelectPartyPopup'); + ThemeLoadSelect (OptionsAdvanced.SelectSumPlayers, 'OptionsAdvancedSelectSumPlayers'); ThemeLoadButton (OptionsAdvanced.ButtonExit, 'OptionsAdvancedButtonExit'); //error and check popup diff --git a/Game/Code/Menu/UDisplay.pas b/Game/Code/Menu/UDisplay.pas index 430cf442..4612b361 100644 --- a/Game/Code/Menu/UDisplay.pas +++ b/Game/Code/Menu/UDisplay.pas @@ -329,7 +329,7 @@ begin if not FileExists(FileName) then break end; - glReadPixels(0, 0, ScreenW, ScreenH, GL_BGRA_EXT, GL_UNSIGNED_BYTE, @PrintScreenData[0]); + glReadPixels(0, 0, ScreenW, ScreenH, GL_RGBA, GL_UNSIGNED_BYTE, @PrintScreenData[0]); Bitmap := TBitmap.Create; Bitmap.Width := ScreenW; Bitmap.Height := ScreenH; diff --git a/Game/Code/Screens/UScreenOptionsAdvanced.pas b/Game/Code/Screens/UScreenOptionsAdvanced.pas index 730f333f..18182153 100644 --- a/Game/Code/Screens/UScreenOptionsAdvanced.pas +++ b/Game/Code/Screens/UScreenOptionsAdvanced.pas @@ -46,7 +46,7 @@ begin begin //SelectLoadAnimation Hidden because it is useless atm //if SelInteraction = 7 then begin - if SelInteraction = 6 then begin + if SelInteraction = 7 then begin Ini.Save; Music.PlayBack; FadeTo(@ScreenOptions); @@ -60,7 +60,7 @@ begin begin //SelectLoadAnimation Hidden because it is useless atm //if (SelInteraction >= 0) and (SelInteraction <= 6) then begin - if (SelInteraction >= 0) and (SelInteraction <= 5) then begin + if (SelInteraction >= 0) and (SelInteraction <= 6) then begin Music.PlayOption; InteractInc; end; @@ -69,7 +69,7 @@ begin begin //SelectLoadAnimation Hidden because it is useless atm //if (SelInteraction >= 0) and (SelInteraction <= 6) then begin - if (SelInteraction >= 0) and (SelInteraction <= 5) then begin + if (SelInteraction >= 0) and (SelInteraction <= 6) then begin Music.PlayOption; InteractDec; end; @@ -94,6 +94,7 @@ begin AddSelectSlide(Theme.OptionsAdvanced.SelectOnSongClick, Ini.OnSongClick, IOnSongClick); AddSelect(Theme.OptionsAdvanced.SelectAskbeforeDel, Ini.AskbeforeDel, IAskbeforeDel); AddSelect(Theme.OptionsAdvanced.SelectPartyPopup, Ini.PartyPopup, IPartyPopup); + AddSelect(Theme.OptionsAdvanced.SelectSumPlayers, Ini.SumPlayers, ISumPlayers); AddButton(Theme.OptionsAdvanced.ButtonExit); if (Length(Button[0].Text)=0) then diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index b4ccc795..54dd4563 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -33,6 +33,8 @@ type TextP2: integer; //for M2-MOD: show actual player-name p2 TextMedley: array[1..4] of integer; + TextTop: array[0..2] of integer; + StaticTop: integer; FoundCAT: boolean; //for M2-MOD: a cat is chosen, see whats next... @@ -141,6 +143,7 @@ type procedure Refresh; //Refresh Song Sorting procedure DrawEqualizer; procedure ChangeMusic; + procedure LoadTop; procedure StartVideoPreview; //Party Mode procedure SelectRandomSong; @@ -1085,6 +1088,12 @@ begin for I := 1 to 4 do TextMedley[I] := AddText(Theme.Song.TextMedley[I]); + for I := 0 to 2 do + TextTop[I] := AddText(Theme.Song.TextTop[I]); + + StaticTop := AddStatic(Theme.Song.StaticTop); + Static[StaticTop].Texture.Alpha := 0.5; + //for M2-MOD-mode: TextP1 := AddText(Theme.Song.TextP1); TextP2 := AddText(Theme.Song.TextP2); @@ -1788,6 +1797,11 @@ begin if Ini.Players <= 3 then PlayersPlay := Ini.Players + 1; if Ini.Players = 4 then PlayersPlay := 6; + for I := 0 to 2 do + Text[TextTop[I]].Visible := false; + + Static[StaticTop].Visible := false; + //Cat Mod etc if (Ini.Tabs_at_startup = 1) AND (CatSongs.CatNumShow = -1) AND (PlaylistMan.Mode=0) then @@ -1935,6 +1949,7 @@ begin begin StartVideoPreview; CoverTime := 0; + LoadTop; end; SongIndex := -1; @@ -2214,6 +2229,14 @@ begin end else MP3VolumeHandler.changed := false; + if MakeMedley or PartyMedley then + begin + for I := 0 to 2 do + Text[TextTop[I]].Visible := false; + + Static[StaticTop].Visible := false; + end; + DrawExtensions; end; @@ -2372,6 +2395,8 @@ end; //Procedure Change current played Preview procedure TScreenSong.ChangeMusic; +var + I: integer; begin //When Music Preview is avtivated -> then Change Music if (Ini.PreviewVolume <> 0) then @@ -2401,6 +2426,48 @@ begin end else Music.Stop; end; + + LoadTop; +end; + +procedure TScreenSong.LoadTop; +var + I: integer; +begin + //Load Top 3 + if (NOT CatSongs.Song[Interaction].Main) AND (CatSongs.VisibleSongs > 0) and + not MakeMedley and not PartyMedley then + begin + AktSong := CatSongs.Song[Interaction]; + DataBase.ReadScore(AktSong, 3, {Ini.SumPlayers}0); + + for I := 0 to 2 do + begin + Text[TextTop[I]].Text := IntToStr(I+1)+'. '; + end; + + if Length(AktSong.Score[Ini.Difficulty])>0 then + Static[StaticTop].Visible := true + else + Static[StaticTop].Visible := false; + + for I := 0 to Length(AktSong.Score[Ini.Difficulty])-1 do + begin + Text[TextTop[I]].Visible := true; + + Text[TextTop[I]].Text := Text[TextTop[I]].Text + AktSong.Score[Ini.Difficulty, I].Name + '\n' + + AktSong.Score[Ini.Difficulty, I].Date + ' (' + IntToStr(AktSong.Score[Ini.Difficulty, I].Score) + ')'; + end; + + for I := Length(AktSong.Score[Ini.Difficulty]) to 2 do + Text[TextTop[I]].Visible := false; + end else + begin + for I := 0 to 2 do + Text[TextTop[I]].Visible := false; + + Static[StaticTop].Visible := false; + end; end; procedure TScreenSong.StartVideoPreview; diff --git a/Game/Code/Screens/UScreenTop.pas b/Game/Code/Screens/UScreenTop.pas index a7085b36..6279458f 100644 --- a/Game/Code/Screens/UScreenTop.pas +++ b/Game/Code/Screens/UScreenTop.pas @@ -172,7 +172,7 @@ begin if sung then DataBase.WriteScore(AktSong); - DataBase.ReadScore(AktSong); + DataBase.ReadScore(AktSong, 8, Ini.SumPlayers); Text[TextArtistTitle].Text := AktSong.Artist + ' - ' + AktSong.Title; @@ -194,7 +194,7 @@ begin Text[TextName[I]].Visible := false; Text[TextScore[I]].Visible := false; Text[TextDate[I]].Visible := false; - end; + end; Text[TextLevel].Text := IDifficulty[Ini.Difficulty]; diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index 8a0c2a8e..f03783e6 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 r7 beta 2 2010-02-28'; + Version = 'UltraStar Deluxe v1.0.1a Challenge-MOD r7 beta 3 2010-03-01'; var WndTitle: string; diff --git a/Game/Output/Languages/English.ini b/Game/Output/Languages/English.ini index 1ca7c163..6b09460c 100644 --- a/Game/Output/Languages/English.ini +++ b/Game/Output/Languages/English.ini @@ -407,6 +407,10 @@ ERROR_SAVE_FILE_FAILED=Error saving File MSG_HELP_TITLE=Help-System MSG_HELP_KEYMAP=Key mapping +#### AdvancedOptions #### +;new +SING_OPTIONS_ADVANCED_SUMPLAYERS=Sum up Top 8 + ######################################################### # Help System # ######################################################### diff --git a/Game/Output/Languages/German.ini b/Game/Output/Languages/German.ini index f65e5ba3..3908fff3 100644 --- a/Game/Output/Languages/German.ini +++ b/Game/Output/Languages/German.ini @@ -408,6 +408,10 @@ ERROR_SAVE_FILE_FAILED=Fehler beim Speichern MSG_HELP_TITLE=Hilfe-System MSG_HELP_KEYMAP=Tastenbelegung +#### AdvancedOptions #### +;new +SING_OPTIONS_ADVANCED_SUMPLAYERS=Sum up Top 8 + #-------------------------------------------------------# # Help System # #-------------------------------------------------------# diff --git a/Game/Output/Languages/Italian.ini b/Game/Output/Languages/Italian.ini index c35495b1..e98de5c1 100644 --- a/Game/Output/Languages/Italian.ini +++ b/Game/Output/Languages/Italian.ini @@ -398,6 +398,10 @@ SCORE_LEGEND_SCROLL=Scorri INFO_FILE_SAVED=File salvato ERROR_SAVE_FILE_FAILED=Errore salvataggio file +#### AdvancedOptions #### +;new +SING_OPTIONS_ADVANCED_SUMPLAYERS=Sum up Top 8 + #-------------------------------------------------------# # Help System # #-------------------------------------------------------# diff --git a/Game/Output/Themes/Deluxe.ini b/Game/Output/Themes/Deluxe.ini index 579d102d..26c7f431 100644 --- a/Game/Output/Themes/Deluxe.ini +++ b/Game/Output/Themes/Deluxe.ini @@ -4030,11 +4030,31 @@ SBGDColor = Gray STColor = White STDColor = GrayDark -[OptionsAdvancedButtonExit] +[OptionsAdvancedSelectSumPlayers] +Tex =MainBar +TexSBG =SelectBG +Text =SING_OPTIONS_ADVANCED_SUMPLAYERS X = 40 Y = 415 W = 230 H = 70 +SkipX = 50 + +Color = ColorDark +DColor = Gray +TColor = White +TDColor = White +SBGTex =MainBar +SBGColor = ColorDark +SBGDColor = Gray +STColor = White +STDColor = GrayDark + +[OptionsAdvancedButtonExit] +X = 40 +Y = 470 +W = 230 +H = 70 Tex =MainBar Color = ColorDark DColor = Gray @@ -9025,6 +9045,45 @@ Size =7 Align =0 Text=4) Artist - Title +[SongStaticTop] +Tex =SongMenuBG +X =25 +Y =365 +W =220 +H =155 +Z =0.94 +Int=1 +Color =ColorDark +Type=Font Black + +[SongTextTop1] +X =30 +Y =370 +Color=White +Font =0 +Size =9 +Align =0 +Text=1. Player No 1 + +[SongTextTop2] +X =30 +Y =420 +Color=White +Font =0 +Size =9 +Align =0 +Text=2. Player No 2 + +[SongTextTop3] +X =30 +Y =470 +Color=White +Font =0 +Size =9 +Align =0 +Text=3. Player No 3 + + [SongTextM2P1] X = 400 Y = 60 -- cgit v1.2.3