From 72d279e5257f35b48c36641382fba50bf82800a3 Mon Sep 17 00:00:00 2001 From: Stefan Date: Tue, 21 Jan 2020 07:16:30 +0100 Subject: [PATCH] Added possibility to open highscores from song screen If opened from song screen, you can use the Arrow Left/Right keys to switch between the game modes Normal, Short, Medley and Duet. --- Vocaluxe/Screens/CScreenHighscore.cs | 66 ++++++++++++++++++++++------ 1 file changed, 52 insertions(+), 14 deletions(-) diff --git a/Vocaluxe/Screens/CScreenHighscore.cs b/Vocaluxe/Screens/CScreenHighscore.cs index 0e6a746f..5e39e45d 100644 --- a/Vocaluxe/Screens/CScreenHighscore.cs +++ b/Vocaluxe/Screens/CScreenHighscore.cs @@ -49,6 +49,7 @@ namespace Vocaluxe.Screens private int _Round; private int _Pos; private bool _IsDuet; + private bool _FromScreenSong = false; public override EMusicType CurrentMusicType { @@ -113,11 +114,13 @@ namespace Vocaluxe.Screens break; case Keys.Down: - _ChangePos(1); + if (!_FromScreenSong) + _ChangePos(1); break; case Keys.Up: - _ChangePos(-1); + if (!_FromScreenSong) + _ChangePos(-1); break; case Keys.Left: @@ -234,13 +237,31 @@ namespace Vocaluxe.Screens { _Pos = 0; int rounds = CGame.NumRounds; - _Scores = new List[rounds]; - for (int round = 0; round < rounds; round++) + + if (rounds == 0) { - int songID = CGame.GetSong(round).ID; - EGameMode gameMode = CGame.GetGameMode(round); + _FromScreenSong = true; + _Round = (int)EGameMode.TR_GAMEMODE_NORMAL; + _Scores = new List[4]; + int songID = CSongs.VisibleSongs[CScreenSong.getSelectedSongID()].ID; EHighscoreStyle style = CBase.Config.GetHighscoreStyle(); - _Scores[round] = CDataBase.LoadScore(songID, gameMode, style); + + for (int gameModeNum = 0; gameModeNum < 4; gameModeNum++) + { + _Scores[gameModeNum] = CDataBase.LoadScore(songID, (EGameMode)gameModeNum, style); + } + } + else + { + _FromScreenSong = false; + _Scores = new List[rounds]; + for (int round = 0; round < rounds; round++) + { + int songID = CGame.GetSong(round).ID; + EGameMode gameMode = CGame.GetGameMode(round); + EHighscoreStyle style = CBase.Config.GetHighscoreStyle(); + _Scores[round] = CDataBase.LoadScore(songID, gameMode, style); + } } } @@ -248,15 +269,21 @@ namespace Vocaluxe.Screens { _IsDuet = false; CPoints points = CGame.GetPoints(); - CSong song = CGame.GetSong(_Round); + + CSong song; + if (_FromScreenSong) + song = CSongs.GetSong(CSongs.VisibleSongs[CScreenSong.getSelectedSongID()].ID); + else + song = CGame.GetSong(_Round); + if (song == null) return; _Texts[_TextSongName].Text = song.Artist + " - " + song.Title; - if (points.NumRounds > 1) + if (points != null && points.NumRounds > 1) _Texts[_TextSongName].Text += " (" + (_Round + 1) + "/" + points.NumRounds + ")"; - switch (CGame.GetGameMode(_Round)) + switch ((_FromScreenSong ? (EGameMode)_Round : CGame.GetGameMode(_Round))) { case EGameMode.TR_GAMEMODE_NORMAL: _Texts[_TextSongMode].Text = "TR_GAMEMODE_NORMAL"; @@ -296,9 +323,20 @@ namespace Vocaluxe.Screens private void _ChangeRound(int num) { - CPoints points = CGame.GetPoints(); - _Round += num; - _Round = _Round.Clamp(0, points.NumRounds - 1); + if (_FromScreenSong) + { + if (_Round == (int)EGameMode.TR_GAMEMODE_SHORTSONG) + _Round = (int)EGameMode.TR_GAMEMODE_NORMAL; + else + ++_Round; + } + else + { + CPoints points = CGame.GetPoints(); + _Round += num; + _Round = _Round.Clamp(0, points.NumRounds - 1); + } + _UpdateRound(); } @@ -307,4 +345,4 @@ namespace Vocaluxe.Screens CParty.LeavingHighscore(); } } -} \ No newline at end of file +}