aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwhiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-04-05 14:37:58 +0000
committerwhiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-04-05 14:37:58 +0000
commite2cd03822f28a4866f98fb0893a73b02bd60ce03 (patch)
tree36ab7128ac54178763782e97de7f8d000d991774
parent5c46c303e25f84e49e36918bafc8d7eca09a507b (diff)
downloadusdx-e2cd03822f28a4866f98fb0893a73b02bd60ce03.tar.gz
usdx-e2cd03822f28a4866f98fb0893a73b02bd60ce03.tar.xz
usdx-e2cd03822f28a4866f98fb0893a73b02bd60ce03.zip
Added Playlist Support
Working correct with Standard Mode Only for now Now working on Playlist Support for Party Mode git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@59 b956fd51-792f-4845-bead-9b4dfca2ff2c
-rw-r--r--Game/Code/Classes/UPliki.pas3
-rw-r--r--Game/Code/Screens/UScreenSong.pas32
-rw-r--r--Game/Code/Screens/UScreenSongJumpto.pas21
-rw-r--r--Game/Code/Screens/UScreenSongMenu.pas242
-rw-r--r--Game/Code/UltraStar.dpr33
5 files changed, 270 insertions, 61 deletions
diff --git a/Game/Code/Classes/UPliki.pas b/Game/Code/Classes/UPliki.pas
index 475a3752..f7692990 100644
--- a/Game/Code/Classes/UPliki.pas
+++ b/Game/Code/Classes/UPliki.pas
@@ -22,6 +22,7 @@ var
CoversPath: string;
LanguagesPath: string;
PluginPath: string;
+ PlayListPath: string;
Plik: TextFile; // all procedures in this unit operates on this file
PlikC: char;
@@ -49,6 +50,8 @@ begin
//Modi Loader
PluginPath := GamePath + 'Plugins\';
+ PlaylistPath := GamePath + 'Playlists\';
+
DecimalSeparator := ',';
end;
diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas
index 694ecc39..6a1df197 100644
--- a/Game/Code/Screens/UScreenSong.pas
+++ b/Game/Code/Screens/UScreenSong.pas
@@ -314,12 +314,26 @@ begin
begin
if Length(Songs.Song) > 0 then begin
if not CatSongs.Song[Interaction].Main then begin // clicked on Song
- ScreenSongMenu.MenuShow(SM_Main);
+ if CatSongs.CatNumShow = -3 then
+ ScreenSongMenu.MenuShow(SM_Playlist)
+ else
+ ScreenSongMenu.MenuShow(SM_Main);
+ end
+ else
+ begin
+ ScreenSongMenu.MenuShow(SM_Playlist_Load);
end;
end;
end;
- SDLK_J: //Show SongMenu
+ SDLK_P: //Show Playlist Menu
+ begin
+ if Length(Songs.Song) > 0 then begin
+ ScreenSongMenu.MenuShow(SM_Playlist_Load);
+ end;
+ end;
+
+ SDLK_J: //Show Jumpto Menu
begin
if Length(Songs.Song) > 0 then
begin
@@ -699,6 +713,8 @@ begin
end
else if (CatSongs.CatNumShow = -2) then
Text[TextNumber].Text := IntToStr(CatSongs.VisibleIndex(Interaction)+1) + '/' + IntToStr(VS)
+ else if (CatSongs.CatNumShow = -3) then
+ Text[TextNumber].Text := IntToStr(CatSongs.VisibleIndex(Interaction)+1) + '/' + IntToStr(VS)
else if (Ini.Tabs_at_startup = 1) then
Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].CatNumber) + '/' + IntToStr(CatSongs.Song[Interaction - CatSongs.Song[Interaction].CatNumber].CatNumber)
else
@@ -1144,8 +1160,18 @@ begin
UpdateLCD;
end;
+ //Playlist Mode
+ if (Mode = 0) then
+ begin
+ //If Playlist Shown -> Select Next automatically
+ if (CatSongs.CatNumShow = -3) then
+ begin
+ SelectNext;
+ ChangeMusic;
+ end;
+ end
//Party Mode
- if (Mode = 1) then
+ else if (Mode = 1) then
begin
SelectRandomSong;
end;
diff --git a/Game/Code/Screens/UScreenSongJumpto.pas b/Game/Code/Screens/UScreenSongJumpto.pas
index c2107507..123146c7 100644
--- a/Game/Code/Screens/UScreenSongJumpto.pas
+++ b/Game/Code/Screens/UScreenSongJumpto.pas
@@ -8,10 +8,6 @@ uses
type
TScreenSongJumpto = class(TMenu)
private
- Songsfound: String;
- NoSongsfound: String;
- CatText: String;
-
//For ChangeMusic
LastPlayed: Integer;
VisibleBool: Boolean;
@@ -157,13 +153,6 @@ var
I: integer;
begin
inherited Create;
- //Translate Texts //TODO: Port to UTheme (Linebonus and PartyScreens, too
- IType[0] := Language.Translate('SONG_JUMPTO_TYPE1');
- IType[1] := Language.Translate('SONG_JUMPTO_TYPE2');
- IType[2] := Language.Translate('SONG_JUMPTO_TYPE3');
- SongsFound := Language.Translate('SONG_JUMPTO_SONGSFOUND');
- NoSongsFound := Language.Translate('SONG_JUMPTO_NOSONGSFOUND');
- CatText := Language.Translate('SONG_JUMPTO_CATTEXT');
AddBackground(Theme.SongJumpto.Background.Tex);
@@ -172,7 +161,7 @@ begin
AddButtonText(14, 20, '');
SelectType := 0;
- AddSelectSlide(Theme.SongJumpto.SelectSlideType, SelectType, IType);
+ AddSelectSlide(Theme.SongJumpto.SelectSlideType, SelectType, Theme.SongJumpto.IType);
AddText(Theme.SongJumpto.TextFound);
@@ -203,7 +192,7 @@ begin
SelectType := 0;
Button[0].Text[0].Text := '';
- Text[0].Text := NoSongsFound;
+ Text[0].Text := Theme.SongJumpto.NoSongsFound;
end;
//Select Input
@@ -220,15 +209,15 @@ procedure TScreenSongJumpto.SetTextFound(const Count: Cardinal);
begin
if (Count = 0) then
begin
- Text[0].Text := NoSongsFound;
+ Text[0].Text := Theme.SongJumpto.NoSongsFound;
ScreenSong.HideCatTL;
end
else
begin
- Text[0].Text := Format(SongsFound, [Count]);
+ Text[0].Text := Format(Theme.SongJumpto.SongsFound, [Count]);
//Set CatTopLeftText
- ScreenSong.ShowCatTLCustom(Format(CatText, [Button[0].Text[0].Text]));
+ ScreenSong.ShowCatTLCustom(Format(Theme.SongJumpto.CatText, [Button[0].Text[0].Text]));
end;
diff --git a/Game/Code/Screens/UScreenSongMenu.pas b/Game/Code/Screens/UScreenSongMenu.pas
index a5ae2083..849716c4 100644
--- a/Game/Code/Screens/UScreenSongMenu.pas
+++ b/Game/Code/Screens/UScreenSongMenu.pas
@@ -22,7 +22,16 @@ type
const
SM_Main = 1;
+
SM_PlayList = 64 or 1;
+ SM_Playlist_Add = 64 or 2;
+ SM_Playlist_New = 64 or 3;
+
+ SM_Playlist_Del = 64 or 5;
+
+ SM_Playlist_Load = 64 or 8 or 1;
+
+
SM_Party_Main = 128 or 1;
SM_Party_Joker = 128 or 2;
@@ -33,7 +42,7 @@ var
implementation
-uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty;
+uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, UPlaylist;
function TScreenSongMenu.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean;
function IsVisible: Boolean;
@@ -70,6 +79,23 @@ begin
Result := true;
If (PressedDown) Then
begin // Key Down
+ if (CurMenu = SM_Playlist_New) AND (Interaction=0) then
+ begin
+ case PressedKey of
+ SDLK_0..SDLK_9, SDLK_A..SDLK_Z, SDLK_SPACE, SDLK_MINUS, SDLK_EXCLAIM, SDLK_COMMA, SDLK_SLASH, SDLK_ASTERISK, SDLK_QUESTION, SDLK_QUOTE, SDLK_QUOTEDBL:
+ begin
+ Button[Interaction].Text[0].Text := Button[Interaction].Text[0].Text + chr(ScanCode);
+ exit;
+ end;
+
+ SDLK_BACKSPACE:
+ begin
+ Button[Interaction].Text[0].DeleteLastL;
+ exit;
+ end;
+ end;
+ end;
+
case PressedKey of
SDLK_Q:
begin
@@ -87,9 +113,6 @@ begin
HandleReturn;
end;
- // Up and Down could be done at the same time,
- // but I don't want to declare variables inside
- // functions like this one, called so many times
SDLK_DOWN: SelectNext;
SDLK_UP: SelectPrev;
@@ -179,9 +202,9 @@ begin
SelectsS[0].Visible := False;
Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAY');
- Button[1].Text[0].Text := Language.Translate('SONG_MENU_EDIT');
- Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYMODI');
- Button[3].Text[0].Text := Language.Translate('SONG_MENU_CANCEL');
+ Button[1].Text[0].Text := Language.Translate('SONG_MENU_CHANGEPLAYERS');
+ Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_ADD');
+ Button[3].Text[0].Text := Language.Translate('SONG_MENU_EDIT');
end;
SM_PlayList:
@@ -190,17 +213,110 @@ begin
Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST');
Button[0].Visible := True;
+ Button[1].Visible := True;
+ Button[2].Visible := True;
+ Button[3].Visible := True;
+ SelectsS[0].Visible := False;
+
+ Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAY');
+ Button[1].Text[0].Text := Language.Translate('SONG_MENU_CHANGEPLAYERS');
+ Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_DEL');
+ Button[3].Text[0].Text := Language.Translate('SONG_MENU_EDIT');
+ end;
+
+ SM_Playlist_Add:
+ begin
+ CurMenu := sMenu;
+ Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST_ADD');
+
+ Button[0].Visible := True;
+ Button[1].Visible := False;
+ Button[2].Visible := False;
+ Button[3].Visible := True;
+ SelectsS[0].Visible := True;
+
+ Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_ADD_NEW');
+ Button[3].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_ADD_EXISTING');
+
+ SetLength(ISelections, Length(PlaylistMan.Playlists));
+ PlaylistMan.GetNames(ISelections);
+
+ if (Length(ISelections)>=1) then
+ begin
+ UpdateSelectSlideOptions(Theme.SongMenu.SelectSlide3, 0, ISelections, SelectValue);
+ end
+ else
+ begin
+ Button[3].Visible := False;
+ SelectsS[0].Visible := False;
+ Button[2].Visible := True;
+ Button[3].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_NOEXISTING');
+ end;
+ end;
+
+ SM_Playlist_New:
+ begin
+ CurMenu := sMenu;
+ Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST_NEW');
+
+ Button[0].Visible := True;
+ Button[1].Visible := False;
+ Button[2].Visible := True;
+ Button[3].Visible := True;
+ SelectsS[0].Visible := False;
+
+ Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_NEW_UNNAMED');
+ Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_NEW_CREATE');
+ Button[3].Text[0].Text := Language.Translate('SONG_MENU_CANCEL');
+ end;
+
+ SM_PlayList_Del:
+ begin
+ CurMenu := sMenu;
+ Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST_Del');
+
+ Button[0].Visible := True;
Button[1].Visible := False;
Button[2].Visible := False;
Button[3].Visible := True;
SelectsS[0].Visible := False;
- Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_ADD');
- Button[1].Text[0].Text := '';
- Button[2].Text[0].Text := '';
+ Button[0].Text[0].Text := Language.Translate('SONG_MENU_YES');
Button[3].Text[0].Text := Language.Translate('SONG_MENU_CANCEL');
end;
+ SM_Playlist_Load:
+ begin
+ CurMenu := sMenu;
+ Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST_LOAD');
+
+ Button[0].Visible := False;
+ Button[1].Visible := False;
+ Button[2].Visible := False;
+ Button[3].Visible := True;
+ SelectsS[0].Visible := True;
+
+ Button[3].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_LOAD');
+
+ SetLength(ISelections, Length(PlaylistMan.Playlists));
+ PlaylistMan.GetNames(ISelections);
+
+ if (Length(ISelections)>=1) then
+ begin
+ UpdateSelectSlideOptions(Theme.SongMenu.SelectSlide3, 0, ISelections, SelectValue);
+ Interaction := 4;
+ end
+ else
+ begin
+ Button[3].Visible := False;
+ SelectsS[0].Visible := False;
+ Button[2].Visible := True;
+ Button[3].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_NOEXISTING');
+ Interaction := 3;
+ end;
+ end;
+
+
SM_Party_Main:
begin
CurMenu := sMenu;
@@ -242,21 +358,24 @@ begin
Case CurMenu of
SM_Main:
begin
- Visible := False;
Case Interaction of
0: //Button 1
begin
ScreenSong.StartSong;
+ Visible := False;
end;
1: //Button 2
begin
- ScreenSong.OpenEditor;
+ //Select New Players then Sing:
+
+ Visible := False;
end;
2: //Button 3
begin
- //Todo: Add SingleRound Modi Support
+ //Show add to Playlist Menu
+ MenuShow(SM_Playlist_Add);
end;
3: //SelectSlide 3
@@ -266,7 +385,8 @@ begin
4: //Button 4
begin
- //Cancel... (Do Nothing)
+ ScreenSong.OpenEditor;
+ Visible := False;
end;
end;
end;
@@ -277,17 +397,21 @@ begin
Case Interaction of
0: //Button 1
begin
- //
+ ScreenSong.StartSong;
+ Visible := False;
end;
1: //Button 2
begin
- //
+ //Select New Players then Sing:
+
+ Visible := False;
end;
2: //Button 3
begin
- //Todo
+ //Show add to Playlist Menu
+ MenuShow(SM_Playlist_Del);
end;
3: //SelectSlide 3
@@ -297,7 +421,89 @@ begin
4: //Button 4
begin
- //
+ ScreenSong.OpenEditor;
+ Visible := False;
+ end;
+ end;
+ end;
+
+ SM_Playlist_Add:
+ begin
+ Case Interaction of
+ 0: //Button 1
+ begin
+ MenuShow(SM_Playlist_New);
+ end;
+
+ 3: //SelectSlide 3
+ begin
+ //Dummy
+ end;
+
+ 4: //Button 4
+ begin
+ PlaylistMan.AddItem(ScreenSong.Interaction, SelectValue);
+ Visible := False;
+ end;
+ end;
+ end;
+
+ SM_Playlist_New:
+ begin
+ Case Interaction of
+ 0: //Button 1
+ begin
+ //Nothing, Button for Entering Name
+ end;
+
+ 2: //Button 3
+ begin
+ //Create Playlist and Add Song
+ PlaylistMan.AddItem(
+ ScreenSong.Interaction,
+ PlaylistMan.AddPlaylist(Button[0].Text[0].Text));
+ Visible := False;
+ end;
+
+ 3: //SelectSlide 3
+ begin
+ //Cancel -> Go back to Add screen
+ MenuShow(SM_Playlist_Add);
+ end;
+
+ 4: //Button 4
+ begin
+ Visible := False;
+ end;
+ end;
+ end;
+
+ SM_PlayList_Del:
+ begin
+ Visible := False;
+ Case Interaction of
+ 0: //Button 1
+ begin
+ //Delete
+ PlayListMan.DelItem(PlayListMan.GetIndexbySongID(ScreenSong.Interaction));
+ Visible := False;
+ end;
+
+ 4: //Button 4
+ begin
+ MenuShow(SM_Playlist);
+ end;
+ end;
+ end;
+
+ SM_Playlist_Load:
+ begin
+ Case Interaction of
+ 4: //Button 4
+ begin
+ //Load Playlist
+ PlaylistMan.SetPlayList(SelectValue);
+ Visible := False;
end;
end;
end;
diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr
index 65a01257..66638832 100644
--- a/Game/Code/UltraStar.dpr
+++ b/Game/Code/UltraStar.dpr
@@ -6,9 +6,6 @@ program UltraStar;
{$R 'UltraStar.res' 'UltraStar.rc'}
uses
- //------------------------------
- //Includes - Menu System
- //------------------------------
UDisplay in 'Menu\UDisplay.pas',
UMenu in 'Menu\UMenu.pas',
UMenuStatic in 'Menu\UMenuStatic.pas',
@@ -18,10 +15,6 @@ uses
UMenuSelect in 'Menu\UMenuSelect.pas',
UMenuSelectSlide in 'Menu\UMenuSelectSlide.pas',
UDrawTexture in 'Menu\UDrawTexture.pas',
-
- //------------------------------
- //Includes - Classes
- //------------------------------
UGraphic in 'Classes\UGraphic.pas',
UTexture in 'Classes\UTexture.pas',
UMusic in 'Classes\UMusic.pas',
@@ -49,10 +42,6 @@ uses
UGraphicClasses in 'Classes\UGraphicClasses.pas',
UDLLManager in 'Classes\UDLLManager.pas',
UParty in 'Classes\UParty.pas',
-
- //------------------------------
- //Includes - Screens
- //------------------------------
UScreenLoading in 'Screens\UScreenLoading.pas',
UScreenWelcome in 'Screens\UScreenWelcome.pas',
UScreenMain in 'Screens\UScreenMain.pas',
@@ -76,28 +65,17 @@ uses
UScreenTop5 in 'Screens\UScreenTop5.pas',
UScreenSongMenu in 'Screens\UScreenSongMenu.pas',
UScreenSongJumpto in 'Screens\UScreenSongJumpto.pas',
-
- //------------------------------
- //Includes - Screens PartyMode
- //------------------------------
UScreenSingModi in 'Screens\UScreenSingModi.pas',
UScreenPartyNewRound in 'Screens\UScreenPartyNewRound.pas',
UScreenPartyScore in 'Screens\UScreenPartyScore.pas',
UScreenPartyPlayer in 'Screens\UScreenPartyPlayer.pas',
UScreenPartyOptions in 'Screens\UScreenPartyOptions.pas',
UScreenPartyWin in 'Screens\UScreenPartyWin.pas',
-
- //------------------------------
- //Includes - Modi SDK
- //------------------------------
ModiSDK in '..\..\Modis\SDK\ModiSDK.pas',
-
- //------------------------------
- //Includes - Delphi
- //------------------------------
Windows,
SDL,
- SysUtils;
+ SysUtils,
+ UPlaylist in 'Classes\UPlaylist.pas';
const
Version = 'UltraStar Deluxe V 0.90 Beta';
@@ -265,6 +243,13 @@ begin
Log.BenchmarkEnd(1);
Log.LogBenchmark('Loading DataBase System', 1);
+ //Playlist Manager
+ Log.BenchmarkStart(1);
+ Log.LogStatus('Playlist Manager', 'Initialization');
+ PlaylistMan := TPlaylistManager.Create;
+ Log.BenchmarkEnd(1);
+ Log.LogBenchmark('Loading Playlist Manager', 1);
+
//GoldenStarsTwinkleMod
Log.BenchmarkStart(1);
Log.LogStatus('Effect Manager', 'Initialization');