From 3e319ca3ef4b2a4846b06bd8dbcca716e1de839f Mon Sep 17 00:00:00 2001 From: Florian Kuepper Date: Sat, 15 Dec 2012 13:38:22 +0100 Subject: [PATCH 1/8] Don't show popup after singing started with ld. --- Vocaluxe/Screens/CScreenSong.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Vocaluxe/Screens/CScreenSong.cs b/Vocaluxe/Screens/CScreenSong.cs index 3544bae7..b17f7ab9 100644 --- a/Vocaluxe/Screens/CScreenSong.cs +++ b/Vocaluxe/Screens/CScreenSong.cs @@ -411,6 +411,7 @@ namespace Vocaluxe.Screens { if (CSongs.NumVisibleSongs > 0 && SongMenus[htSongMenus(SongMenu)].GetActualSelection() != -1) { + ToggleSongOptions(ESongOptionsView.None); StartVisibleSong(SongMenus[htSongMenus(SongMenu)].GetActualSelection()); return true; } From 94753c62a1079d52c8a7afe6710711fda0453e6a Mon Sep 17 00:00:00 2001 From: Florian Kuepper Date: Sat, 15 Dec 2012 13:48:10 +0100 Subject: [PATCH 2/8] Set duet-parts correctly when singing all (visible) songs. --- Vocaluxe/Screens/CScreenSong.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Vocaluxe/Screens/CScreenSong.cs b/Vocaluxe/Screens/CScreenSong.cs index b17f7ab9..06c58219 100644 --- a/Vocaluxe/Screens/CScreenSong.cs +++ b/Vocaluxe/Screens/CScreenSong.cs @@ -690,7 +690,16 @@ namespace Vocaluxe.Screens EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL; if (CSongs.AllSongs[SongNr].IsDuet) + { gm = EGameMode.TR_GAMEMODE_DUET; + for (int i = 0; i < CSettings.MaxNumPlayer; i++) + { + if ((i % 2) == 0) + CGame.Player[i].LineNr = 1; + else + CGame.Player[i].LineNr = 1; + } + } CGame.AddSong(SongNr, gm); IDs.Remove(SongNr); @@ -717,7 +726,16 @@ namespace Vocaluxe.Screens EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL; if (CSongs.AllSongs[SongNr].IsDuet) + { gm = EGameMode.TR_GAMEMODE_DUET; + for (int i = 0; i < CSettings.MaxNumPlayer; i++) + { + if ((i % 2) == 0) + CGame.Player[i].LineNr = 1; + else + CGame.Player[i].LineNr = 1; + } + } CGame.AddSong(SongNr, gm); From 225d9326ea9f9f1582c70aae9634276b5c375254 Mon Sep 17 00:00:00 2001 From: Florian Kuepper Date: Sat, 15 Dec 2012 14:03:19 +0100 Subject: [PATCH 3/8] Revert last changes and do this in a better way. --- Vocaluxe/Screens/CScreenSing.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Vocaluxe/Screens/CScreenSing.cs b/Vocaluxe/Screens/CScreenSing.cs index 11c57146..ba615c7a 100644 --- a/Vocaluxe/Screens/CScreenSing.cs +++ b/Vocaluxe/Screens/CScreenSing.cs @@ -645,9 +645,12 @@ namespace Vocaluxe.Screens //Otherwise, this is done by CScreenNames if (CGame.GetNumSongs() > 1) { - for (int i = 1; i <= CGame.NumPlayer; i = i + 2) + for (int i = 0; i < CGame.NumPlayer; i++) { - CGame.Player[i].LineNr = 1; + if ((i % 2) == 0) + CGame.Player[i].LineNr = 1; + else + CGame.Player[i].LineNr = 0; } } else From fdceea0bdf3b3ff7100b3f6e2b80f6a05f2bcc0c Mon Sep 17 00:00:00 2001 From: Florian Kuepper Date: Sat, 15 Dec 2012 14:04:35 +0100 Subject: [PATCH 4/8] Revert. --- Vocaluxe/Screens/CScreenSong.cs | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/Vocaluxe/Screens/CScreenSong.cs b/Vocaluxe/Screens/CScreenSong.cs index 06c58219..7266dcdc 100644 --- a/Vocaluxe/Screens/CScreenSong.cs +++ b/Vocaluxe/Screens/CScreenSong.cs @@ -690,16 +690,8 @@ namespace Vocaluxe.Screens EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL; if (CSongs.AllSongs[SongNr].IsDuet) - { gm = EGameMode.TR_GAMEMODE_DUET; - for (int i = 0; i < CSettings.MaxNumPlayer; i++) - { - if ((i % 2) == 0) - CGame.Player[i].LineNr = 1; - else - CGame.Player[i].LineNr = 1; - } - } + CGame.AddSong(SongNr, gm); IDs.Remove(SongNr); @@ -726,16 +718,7 @@ namespace Vocaluxe.Screens EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL; if (CSongs.AllSongs[SongNr].IsDuet) - { gm = EGameMode.TR_GAMEMODE_DUET; - for (int i = 0; i < CSettings.MaxNumPlayer; i++) - { - if ((i % 2) == 0) - CGame.Player[i].LineNr = 1; - else - CGame.Player[i].LineNr = 1; - } - } CGame.AddSong(SongNr, gm); From 431d7d2bb2635d4016c7328ceaf752ced0d0f722 Mon Sep 17 00:00:00 2001 From: Florian Kuepper Date: Mon, 17 Dec 2012 20:58:53 +0100 Subject: [PATCH 5/8] First fix for highscore-screen. --- Vocaluxe/Screens/CScreenHighscore.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Vocaluxe/Screens/CScreenHighscore.cs b/Vocaluxe/Screens/CScreenHighscore.cs index 5704ce63..f1faed80 100644 --- a/Vocaluxe/Screens/CScreenHighscore.cs +++ b/Vocaluxe/Screens/CScreenHighscore.cs @@ -179,6 +179,13 @@ namespace Vocaluxe.Screens Texts[htTexts(TextScore[p])].Style = EStyle.BoldItalic; Texts[htTexts(TextDate[p])].Style = EStyle.BoldItalic; } + else + { + Texts[htTexts(TextNumber[p])].Style = EStyle.Normal; + Texts[htTexts(TextName[p])].Style = EStyle.Normal; + Texts[htTexts(TextScore[p])].Style = EStyle.Normal; + Texts[htTexts(TextDate[p])].Style = EStyle.Normal; + } } else { From c0c1934747c2f37c29065ef1d35d96ee81564729 Mon Sep 17 00:00:00 2001 From: Florian Kuepper Date: Mon, 17 Dec 2012 21:46:15 +0100 Subject: [PATCH 6/8] Added ShortSong to HighscoreDB. Increase HighscoreDB-Version. --- Vocaluxe/Base/CDataBase.cs | 71 ++++++++++++++++++++++++++++++-------- Vocaluxe/Base/CSettings.cs | 2 +- 2 files changed, 58 insertions(+), 15 deletions(-) diff --git a/Vocaluxe/Base/CDataBase.cs b/Vocaluxe/Base/CDataBase.cs index cadb499f..a7aa744f 100644 --- a/Vocaluxe/Base/CDataBase.cs +++ b/Vocaluxe/Base/CDataBase.cs @@ -53,7 +53,7 @@ namespace Vocaluxe.Base } #region Highscores - public static int AddScore(string PlayerName, int Score, int LineNr, long Date, int Medley, int Duet, int Diff, + public static int AddScore(string PlayerName, int Score, int LineNr, long Date, int Medley, int Duet, int ShortSong, int Diff, string Artist, string Title, int NumPlayed, string FilePath) { SPlayer player = new SPlayer(); @@ -63,6 +63,7 @@ namespace Vocaluxe.Base player.DateTicks = Date; player.Medley = (Medley == 1); player.Duet = (Duet == 1); + player.ShortSong = (ShortSong == 1); player.Difficulty = (EGameDifficulty)Diff; SQLiteConnection connection = new SQLiteConnection(); @@ -133,8 +134,12 @@ namespace Vocaluxe.Base if (player.Duet) Duet = 1; + int ShortSong = 0; + if (player.ShortSong) + ShortSong = 1; + command.CommandText = "SELECT id FROM Scores WHERE SongID = @SongID AND PlayerName = @PlayerName AND Score = @Score AND " + - "LineNr = @LineNr AND Date = @Date AND Medley = @Medley AND Duet = @Duet AND Difficulty = @Difficulty"; + "LineNr = @LineNr AND Date = @Date AND Medley = @Medley AND Duet = @Duet AND ShortSong = @ShortSong AND Difficulty = @Difficulty"; command.Parameters.Add("@SongID", System.Data.DbType.Int32, 0).Value = DataBaseSongID; command.Parameters.Add("@PlayerName", System.Data.DbType.String, 0).Value = player.Name; command.Parameters.Add("@Score", System.Data.DbType.Int32, 0).Value = (int)Math.Round(player.Points); @@ -142,6 +147,7 @@ namespace Vocaluxe.Base command.Parameters.Add("@Date", System.Data.DbType.Int64, 0).Value = player.DateTicks; command.Parameters.Add("@Medley", System.Data.DbType.Int32, 0).Value = Medley; command.Parameters.Add("@Duet", System.Data.DbType.Int32, 0).Value = Duet; + command.Parameters.Add("@ShortSong", System.Data.DbType.Int32, 0).Value = ShortSong; command.Parameters.Add("@Difficulty", System.Data.DbType.Int32, 0).Value = (int)player.Difficulty; SQLiteDataReader reader = null; @@ -164,8 +170,8 @@ namespace Vocaluxe.Base reader.Close(); - command.CommandText = "INSERT INTO Scores (SongID, PlayerName, Score, LineNr, Date, Medley, Duet, Difficulty) " + - "VALUES (@SongID, @PlayerName, @Score, @LineNr, @Date, @Medley, @Duet, @Difficulty)"; + command.CommandText = "INSERT INTO Scores (SongID, PlayerName, Score, LineNr, Date, Medley, Duet, ShortSong, Difficulty) " + + "VALUES (@SongID, @PlayerName, @Score, @LineNr, @Date, @Medley, @Duet, @ShortSong, @Difficulty)"; command.Parameters.Add("@SongID", System.Data.DbType.Int32, 0).Value = DataBaseSongID; command.Parameters.Add("@PlayerName", System.Data.DbType.String, 0).Value = player.Name; command.Parameters.Add("@Score", System.Data.DbType.Int32, 0).Value = (int)Math.Round(player.Points); @@ -173,6 +179,7 @@ namespace Vocaluxe.Base command.Parameters.Add("@Date", System.Data.DbType.Int64, 0).Value = player.DateTicks; command.Parameters.Add("@Medley", System.Data.DbType.Int32, 0).Value = Medley; command.Parameters.Add("@Duet", System.Data.DbType.Int32, 0).Value = Duet; + command.Parameters.Add("@ShortSong", System.Data.DbType.Int32, 0).Value = Duet; command.Parameters.Add("@Difficulty", System.Data.DbType.Int32, 0).Value = (int)player.Difficulty; command.ExecuteNonQuery(); @@ -231,15 +238,20 @@ namespace Vocaluxe.Base if (player.Duet) Duet = 1; + int ShortSong = 0; + if (player.ShortSong) + ShortSong = 1; + int DataBaseSongID = GetDataBaseSongID(player, command); if (DataBaseSongID >= 0) { command.CommandText = "SELECT PlayerName, Score, Date, Difficulty, LineNr, id FROM Scores " + - "WHERE [SongID] = @SongID AND [Medley] = @Medley AND [Duet] = @Duet " + + "WHERE [SongID] = @SongID AND [Medley] = @Medley AND [Duet] = @Duet AND [ShortSong] = @ShortSong" + "ORDER BY [Score] DESC"; command.Parameters.Add("@SongID", System.Data.DbType.Int32, 0).Value = DataBaseSongID; command.Parameters.Add("@Medley", System.Data.DbType.Int32, 0).Value = Medley; command.Parameters.Add("@Duet", System.Data.DbType.Int32, 0).Value = Duet; + command.Parameters.Add("@ShortSong", System.Data.DbType.Int32, 0).Value = ShortSong; SQLiteDataReader reader = null; try @@ -494,7 +506,7 @@ namespace Vocaluxe.Base command.CommandText = "CREATE TABLE IF NOT EXISTS Scores ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, " + "SongID INTEGER NOT NULL, PlayerName TEXT NOT NULL, Score INTEGER NOT NULL, LineNr INTEGER NOT NULL, Date BIGINT NOT NULL, " + - "Medley INTEGER NOT NULL, Duet INTEGER NOT NULL, Difficulty INTEGER NOT NULL);"; + "Medley INTEGER NOT NULL, Duet INTEGER NOT NULL, ShortSong INTEGER NOT NULL, Difficulty INTEGER NOT NULL);"; command.ExecuteNonQuery(); command.Dispose(); @@ -549,10 +561,11 @@ namespace Vocaluxe.Base else { reader.Read(); - - if (reader.GetInt32(0) < CSettings.iDatabaseHighscoreVersion) + int CurrentVersion = reader.GetInt32(0); + if (CurrentVersion < CSettings.iDatabaseHighscoreVersion) { // update database + UpdateDatabase(CurrentVersion, connection); } } @@ -618,7 +631,7 @@ namespace Vocaluxe.Base command = new SQLiteCommand(connection); //The USDX database has no column for LineNr, Medley and Duet so just fill 0 in there - command.CommandText = "INSERT INTO Scores (SongID, PlayerName, Score, LineNr, Date, Medley, Duet, Difficulty) SELECT SongID, Player, Score, '0', Date, '0', '0', Difficulty from US_Scores"; + command.CommandText = "INSERT INTO Scores (SongID, PlayerName, Score, LineNr, Date, Medley, Duet, ShortSong, Difficulty) SELECT SongID, Player, Score, '0', Date, '0', '0', '0', Difficulty from US_Scores"; command.ExecuteNonQuery(); command.CommandText = "INSERT INTO Songs SELECT ID, Artist, Title, TimesPlayed from US_Songs"; @@ -766,9 +779,9 @@ namespace Vocaluxe.Base //This is a USDX 1.01 DB if (!dateExists) - command.CommandText = "INSERT INTO Scores (SongID, PlayerName, Score, LineNr, Date, Medley, Duet, Difficulty) SELECT SongID, Player, Score, '0', '0', '0', '0', Difficulty from US_Scores"; + command.CommandText = "INSERT INTO Scores (SongID, PlayerName, Score, LineNr, Date, Medley, Duet, ShortSong, Difficulty) SELECT SongID, Player, Score, '0', '0', '0', '0', '0', Difficulty from US_Scores"; else // This is a CMD 1.01 DB - command.CommandText = "INSERT INTO Scores (SongID, PlayerName, Score, LineNr, Date, Medley, Duet, Difficulty) SELECT SongID, Player, Score, '0', Date, '0', '0', Difficulty from US_Scores"; + command.CommandText = "INSERT INTO Scores (SongID, PlayerName, Score, LineNr, Date, Medley, Duet, ShortSong, Difficulty) SELECT SongID, Player, Score, '0', Date, '0', '0', '0', Difficulty from US_Scores"; command.ExecuteNonQuery(); command.CommandText = "INSERT INTO Songs SELECT ID, Artist, Title, TimesPlayed from US_Songs"; @@ -905,6 +918,35 @@ namespace Vocaluxe.Base return true; } + private static bool UpdateDatabase(int CurrentVersion, SQLiteConnection connection) + { + bool updated = true; + if (CurrentVersion < 2) + { + updated &= ConvertV1toV2(connection); + } + return updated; + } + + private static bool ConvertV1toV2(SQLiteConnection connection) + { + SQLiteCommand command; + + command = new SQLiteCommand(connection); + + command.CommandText = "ALTER TABLE Scores ADD ShortSong INTEGER"; + command.ExecuteNonQuery(); + command.CommandText = "UPDATE Scores SET [ShortSong] = @ShortSong"; + command.Parameters.Add("@ShortSong", System.Data.DbType.Int32, 0).Value = 0; + command.ExecuteNonQuery(); + command.CommandText = "UPDATE Version SET [Value] = @version"; + command.Parameters.Add("@version", System.Data.DbType.Int32, 0).Value = 2; + command.ExecuteNonQuery(); + command.Dispose(); + + return true; + } + private static bool ImportData(string SourceDBPath, string DestinationDBPath) { #region open db @@ -926,7 +968,7 @@ namespace Vocaluxe.Base SQLiteDataReader rSource; #region import table scores - cmdSource.CommandText = "SELECT SongID, PlayerName, Score, LineNr, Date, Medley, Duet, Difficulty FROM Scores"; + cmdSource.CommandText = "SELECT SongID, PlayerName, Score, LineNr, Date, Medley, Duet, ShortSong, Difficulty FROM Scores"; rSource = cmdSource.ExecuteReader(); if (rSource == null) { @@ -952,13 +994,14 @@ namespace Vocaluxe.Base long date = rSource.GetInt64(4); int medley = rSource.GetInt32(5); int duet = rSource.GetInt32(6); - int diff = rSource.GetInt32(7); + int shortsong = rSource.GetInt32(7); + int diff = rSource.GetInt32(8); string artist, title; int numplayed; if (GetDataBaseSongInfos(songid, out artist, out title, out numplayed, SourceDBPath)) { - AddScore(player, score, linenr, date, medley, duet, diff, artist, title, numplayed, _HighscoreFilePath); + AddScore(player, score, linenr, date, medley, duet, shortsong, diff, artist, title, numplayed, _HighscoreFilePath); } } #endregion import table scores diff --git a/Vocaluxe/Base/CSettings.cs b/Vocaluxe/Base/CSettings.cs index da827ca0..bdcf2bc6 100644 --- a/Vocaluxe/Base/CSettings.cs +++ b/Vocaluxe/Base/CSettings.cs @@ -49,7 +49,7 @@ namespace Vocaluxe.Base public const int iBuild = 70; // Increase on every published version! Never Reset! - public const int iDatabaseHighscoreVersion = 1; + public const int iDatabaseHighscoreVersion = 2; public const int iDatabaseCoverVersion = 1; public const int iDatabaseCreditsRessourcesVersion = 1; From a44e8d9927f6024f8ec2d629c25f6bdb75236130 Mon Sep 17 00:00:00 2001 From: Florian Kuepper Date: Mon, 17 Dec 2012 21:51:31 +0100 Subject: [PATCH 7/8] Fixed mysql-bug. --- Vocaluxe/Base/CDataBase.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Vocaluxe/Base/CDataBase.cs b/Vocaluxe/Base/CDataBase.cs index a7aa744f..3d4d691c 100644 --- a/Vocaluxe/Base/CDataBase.cs +++ b/Vocaluxe/Base/CDataBase.cs @@ -246,7 +246,7 @@ namespace Vocaluxe.Base if (DataBaseSongID >= 0) { command.CommandText = "SELECT PlayerName, Score, Date, Difficulty, LineNr, id FROM Scores " + - "WHERE [SongID] = @SongID AND [Medley] = @Medley AND [Duet] = @Duet AND [ShortSong] = @ShortSong" + + "WHERE [SongID] = @SongID AND [Medley] = @Medley AND [Duet] = @Duet AND [ShortSong] = @ShortSong " + "ORDER BY [Score] DESC"; command.Parameters.Add("@SongID", System.Data.DbType.Int32, 0).Value = DataBaseSongID; command.Parameters.Add("@Medley", System.Data.DbType.Int32, 0).Value = Medley; From 1c00f0eb4406b69db2cd601071dc1ecc3ad3e36d Mon Sep 17 00:00:00 2001 From: Florian Kuepper Date: Mon, 17 Dec 2012 22:07:13 +0100 Subject: [PATCH 8/8] Style-work on highscore-screen. --- Vocaluxe/Screens/CScreenHighscore.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Vocaluxe/Screens/CScreenHighscore.cs b/Vocaluxe/Screens/CScreenHighscore.cs index f1faed80..9cdc6c38 100644 --- a/Vocaluxe/Screens/CScreenHighscore.cs +++ b/Vocaluxe/Screens/CScreenHighscore.cs @@ -181,10 +181,10 @@ namespace Vocaluxe.Screens } else { - Texts[htTexts(TextNumber[p])].Style = EStyle.Normal; - Texts[htTexts(TextName[p])].Style = EStyle.Normal; - Texts[htTexts(TextScore[p])].Style = EStyle.Normal; - Texts[htTexts(TextDate[p])].Style = EStyle.Normal; + Texts[htTexts(TextNumber[p])].Style = EStyle.Bold; + Texts[htTexts(TextName[p])].Style = EStyle.Bold; + Texts[htTexts(TextScore[p])].Style = EStyle.Bold; + Texts[htTexts(TextDate[p])].Style = EStyle.Bold; } } else