From 1b458d8b1f4723ce82bb74f2157982980274e79c Mon Sep 17 00:00:00 2001 From: jaybinks Date: Mon, 14 Jan 2008 12:27:38 +0000 Subject: tidy up sing mode, to be an enum now. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@794 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UPlaylist.pas | 7 +++- Game/Code/Classes/USong.pas | 2 + Game/Code/Screens/UScreenLevel.pas | 8 +++- Game/Code/Screens/UScreenOptionsRecord.pas | 2 +- Game/Code/Screens/UScreenPartyNewRound.pas | 12 +++++- Game/Code/Screens/UScreenPartyOptions.pas | 4 +- Game/Code/Screens/UScreenSing.pas | 5 ++- Game/Code/Screens/UScreenSong.pas | 60 ++++++++++++++++-------------- 8 files changed, 61 insertions(+), 39 deletions(-) diff --git a/Game/Code/Classes/UPlaylist.pas b/Game/Code/Classes/UPlaylist.pas index 8d981065..2c09c493 100644 --- a/Game/Code/Classes/UPlaylist.pas +++ b/Game/Code/Classes/UPlaylist.pas @@ -9,6 +9,9 @@ interface {$I switches.inc} +uses + USong; + type TPlaylistItem = record Artist: String; @@ -33,7 +36,7 @@ type private public - Mode: Byte; //Current Playlist Mode for SongScreen + Mode: TSingMode; //Current Playlist Mode for SongScreen CurPlayList: Cardinal; CurItem: Cardinal; @@ -262,7 +265,7 @@ begin //Set CatSongsMode + Playlist Mode CatSongs.CatNumShow := -3; - Mode := 2; + Mode := smPlayListRandom; //Set CurPlaylist CurPlaylist := Index; diff --git a/Game/Code/Classes/USong.pas b/Game/Code/Classes/USong.pas index 6af16a1a..728f5055 100644 --- a/Game/Code/Classes/USong.pas +++ b/Game/Code/Classes/USong.pas @@ -33,6 +33,8 @@ uses type + TSingMode = ( smNormal, smPartyMode, smPlaylistRandom ); + TBPM = record BPM: real; StartBeat: real; diff --git a/Game/Code/Screens/UScreenLevel.pas b/Game/Code/Screens/UScreenLevel.pas index d4b528b5..e5deb6ba 100644 --- a/Game/Code/Screens/UScreenLevel.pas +++ b/Game/Code/Screens/UScreenLevel.pas @@ -18,7 +18,11 @@ type implementation -uses UGraphic, UMain, UIni, UTexture; +uses UGraphic, + UMain, + UIni, + USong, + UTexture; function TScreenLevel.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; begin @@ -44,7 +48,7 @@ begin Ini.SaveLevel; AudioPlayback.PlayStart; //Set Standard Mode - ScreenSong.Mode := 0; + ScreenSong.Mode := smNormal; FadeTo(@ScreenSong); end; diff --git a/Game/Code/Screens/UScreenOptionsRecord.pas b/Game/Code/Screens/UScreenOptionsRecord.pas index 42776717..65d016c7 100644 --- a/Game/Code/Screens/UScreenOptionsRecord.pas +++ b/Game/Code/Screens/UScreenOptionsRecord.pas @@ -124,7 +124,7 @@ begin Interaction := 0; writeln( 'AudioInput.CaptureStart') ; - PlayersPlay := 2; // TODO : This needs fixing + PlayersPlay := 2; // TODO : This needs fixing AudioInput.CaptureStart; end; diff --git a/Game/Code/Screens/UScreenPartyNewRound.pas b/Game/Code/Screens/UScreenPartyNewRound.pas index 6f039080..2f07dcb0 100644 --- a/Game/Code/Screens/UScreenPartyNewRound.pas +++ b/Game/Code/Screens/UScreenPartyNewRound.pas @@ -76,7 +76,15 @@ type implementation -uses UGraphic, UMain, UIni, UTexture, UParty, UDLLManager, ULanguage, ULog; +uses UGraphic, + UMain, + UIni, + UTexture, + UParty, + UDLLManager, + ULanguage, + USong, + ULog; function TScreenPartyNewRound.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; begin @@ -103,7 +111,7 @@ begin if DLLMan.Selected.LoadSong then begin //Select PartyMode ScreenSong - ScreenSong.Mode := 1; + ScreenSong.Mode := smPartyMode; FadeTo(@ScreenSong); end else diff --git a/Game/Code/Screens/UScreenPartyOptions.pas b/Game/Code/Screens/UScreenPartyOptions.pas index 46a075ce..c8cb2bb5 100644 --- a/Game/Code/Screens/UScreenPartyOptions.pas +++ b/Game/Code/Screens/UScreenPartyOptions.pas @@ -46,7 +46,7 @@ const implementation -uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, UDLLManager, UPlaylist, USongs; +uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, USong, UDLLManager, UPlaylist, USongs; function TScreenPartyOptions.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; var @@ -96,7 +96,7 @@ begin PartySession.Teams.Teaminfo[2].NumPlayers := NumPlayer3+1;} //Save Playlist - PlaylistMan.Mode := Playlist; + PlaylistMan.Mode := TSingMode( Playlist ); PlaylistMan.CurPlayList := High(Cardinal); //If Category Selected Search Category ID if Playlist = 1 then diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index adfc4d2c..5216477d 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -120,6 +120,7 @@ implementation uses UGraphic, UDraw, UMain, + USong, Classes, URecord, ULanguage, @@ -443,7 +444,7 @@ begin //Error Loading Song -> Go back to Song Screen and Show some Error Message FadeTo(@ScreenSong); //Select New Song in Party Mode - if ScreenSong.Mode = 1 then + if ScreenSong.Mode = smPartyMode then ScreenSong.SelectRandomSong; ScreenPopupError.ShowPopup (Language.Translate('ERROR_CORRUPT_SONG')); Exit; @@ -452,7 +453,7 @@ begin //Error Loading Song -> Go back to Song Screen and Show some Error Message FadeTo(@ScreenSong); //Select New Song in Party Mode - if ScreenSong.Mode = 1 then + if ScreenSong.Mode = smPartyMode then ScreenSong.SelectRandomSong; ScreenPopupError.ShowPopup (Language.Translate('ERROR_CORRUPT_SONG')); Exit; diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index a54bda9f..4773cdac 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -24,6 +24,7 @@ uses ULanguage, ULCD, ULight, + USong, UIni; type @@ -56,7 +57,8 @@ type EqualizerTime2: Byte; //Party Mod - Mode: Byte; //0 = Standard, 1= Go to PartyMode after Selection + Change to Random Song at Show + Mode: TSingMode; + //party Statics (Joker) StaticTeam1Joker1: Cardinal; StaticTeam1Joker2: Cardinal; @@ -252,7 +254,7 @@ begin + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT); //Jump to Artist/Titel - if (SDL_ModState and KMOD_LALT <> 0) AND (Mode = 0) AND (PressedKey >= SDLK_A) AND (PressedKey <= SDLK_Z) then + if (SDL_ModState and KMOD_LALT <> 0) AND (Mode = smNormal) AND (PressedKey >= SDLK_A) AND (PressedKey <= SDLK_Z) then begin Letter := UpCase(Chr(ScanCode)); I2 := Length(CatSongs.Song); @@ -312,7 +314,7 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE : begin - if (Mode = 0) then + if (Mode = smNormal) then begin //On Escape goto Cat-List Hack if (Ini.Tabs_at_startup = 1) AND (CatSongs.CatNumShow <> -1) then @@ -375,7 +377,7 @@ begin end; end //When in party Mode then Ask before Close - else if (Mode = 1) then + else if (Mode = smPartyMode) then begin AudioPlayback.PlayBack; CheckFadeTo(@ScreenMain,'MSG_END_PARTY'); @@ -410,8 +412,10 @@ begin //Play Music: ChangeMusic; - end else begin // clicked on song - if (Mode = 0) then //Normal Mode -> Start Song + end + else + begin // clicked on song + if (Mode = smNormal) then //Normal Mode -> Start Song begin //Do the Action that is specified in Ini case Ini.OnSongClick of @@ -425,7 +429,7 @@ begin end; end; end - else if (Mode = 1) then //PartyMode -> Show Menu + else if (Mode = smPartyMode) then //PartyMode -> Show Menu begin if (Ini.PartyPopup = 1) then ScreenSongMenu.MenuShow(SM_Party_Main) @@ -439,7 +443,7 @@ begin SDLK_M: //Show SongMenu begin if (Songs.SongList.Count > 0) then begin - if (Mode = 0) then begin + if (Mode = smNormal) then begin if not CatSongs.Song[Interaction].Main then begin // clicked on Song if CatSongs.CatNumShow = -3 then ScreenSongMenu.MenuShow(SM_Playlist) @@ -457,14 +461,14 @@ begin SDLK_P: //Show Playlist Menu begin - if (Songs.SongList.Count > 0) AND (Mode = 0) then begin + if (Songs.SongList.Count > 0) AND (Mode = smNormal) then begin ScreenSongMenu.MenuShow(SM_Playlist_Load); end; end; SDLK_J: //Show Jumpto Menu begin - if (Songs.SongList.Count > 0) AND (Mode = 0) then + if (Songs.SongList.Count > 0) AND (Mode = smNormal) then begin ScreenSongJumpto.Visible := True; end; @@ -472,7 +476,7 @@ begin SDLK_DOWN: begin - if (Mode = 0) then + if (Mode = smNormal) then begin //Only Change Cat when not in Playlist or Search Mode if (CatSongs.CatNumShow > -2) then @@ -512,7 +516,7 @@ begin end; SDLK_UP: begin - if (Mode = 0) then + if (Mode = smNormal) then begin //Only Change Cat when not in Playlist or Search Mode if (CatSongs.CatNumShow > -2) then @@ -553,7 +557,7 @@ begin SDLK_RIGHT: begin - if (Songs.SongList.Count > 0) AND (Mode = 0) then + if (Songs.SongList.Count > 0) AND (Mode = smNormal) then begin AudioPlayback.PlayChange; SelectNext; @@ -568,7 +572,7 @@ begin SDLK_LEFT: begin - if (Songs.SongList.Count > 0)AND (Mode = 0) then begin + if (Songs.SongList.Count > 0)AND (Mode = smNormal) then begin AudioPlayback.PlayChange; SelectPrev; ChangeMusic; @@ -585,7 +589,7 @@ begin SDLK_R: begin - if (Songs.SongList.Count > 0) AND (Mode = 0) then begin + if (Songs.SongList.Count > 0) AND (Mode = smNormal) then begin if (SDL_ModState = KMOD_LSHIFT) AND (Ini.Tabs_at_startup = 1) then //Random Category begin @@ -661,7 +665,7 @@ begin SDLK_1: begin //Jocker // to-do : Party - {if (Mode = 1) AND (PartySession.Teams.NumTeams >= 1) AND (PartySession.Teams.Teaminfo[0].Joker > 0) then + {if (Mode = smPartyMode) AND (PartySession.Teams.NumTeams >= 1) AND (PartySession.Teams.Teaminfo[0].Joker > 0) then begin //Joker spielen Dec(PartySession.Teams.Teaminfo[0].Joker); @@ -672,7 +676,7 @@ begin SDLK_2: begin //Jocker - {if (Mode = 1) AND (PartySession.Teams.NumTeams >= 2) AND (PartySession.Teams.Teaminfo[1].Joker > 0) then + {if (Mode = smPartyMode) AND (PartySession.Teams.NumTeams >= 2) AND (PartySession.Teams.Teaminfo[1].Joker > 0) then begin //Joker spielen Dec(PartySession.Teams.Teaminfo[1].Joker); @@ -683,7 +687,7 @@ begin SDLK_3: begin //Jocker - {if (Mode = 1) AND (PartySession.Teams.NumTeams >= 3) AND (PartySession.Teams.Teaminfo[2].Joker > 0) then + {if (Mode = smPartyMode) AND (PartySession.Teams.NumTeams >= 3) AND (PartySession.Teams.Teaminfo[2].Joker > 0) then begin //Joker spielen Dec(PartySession.Teams.Teaminfo[2].Joker); @@ -1540,7 +1544,7 @@ begin end; //Playlist Mode - if (Mode = 0) then + if (Mode = smNormal) then begin //If Playlist Shown -> Select Next automatically if (CatSongs.CatNumShow = -3) then @@ -1550,7 +1554,7 @@ begin end; end //Party Mode - else if (Mode = 1) then + else if (Mode = smPartyMode) then begin SelectRandomSong; @@ -1931,7 +1935,7 @@ var I, I2: Integer; begin Case PlaylistMan.Mode of - 0: //All Songs Just Select Random Song + smNormal: //All Songs Just Select Random Song begin //When Tabs are activated then use Tab Method if (Ini.Tabs_at_startup = 1) then @@ -1965,7 +1969,7 @@ begin else SkipTo(Random(CatSongs.VisibleSongs)); end; - 1: //One Category Select Category and Select Random Song + smPartyMode: //One Category Select Category and Select Random Song begin CatSongs.ShowCategoryList; CatSongs.ClickCategoryButton(PlaylistMan.CurPlayList); @@ -1976,7 +1980,7 @@ begin SkipTo(Random(CatSongs.VisibleSongs)); end; - 2: //Playlist: Select Playlist and Select Random Song + smPlaylistRandom: //Playlist: Select Playlist and Select Random Song begin PlaylistMan.SetPlayList(PlaylistMan.CurPlayList); @@ -1995,7 +1999,7 @@ procedure TScreenSong.SetJoker; begin {//If Party Mode // to-do : Party - if Mode = 1 then //Show Joker that are available + if Mode = smPartyMode then //Show Joker that are available begin if (PartySession.Teams.NumTeams >= 1) then begin @@ -2076,7 +2080,7 @@ var Visible: Boolean; begin //Set Visibility of Party Statics and Text - Visible := (Mode = 1); + Visible := (Mode = smPartyMode); For I := 0 to high(StaticParty) do Static[StaticParty[I]].Visible := Visible; @@ -2101,7 +2105,7 @@ begin CatSongs.Selected := Interaction; AudioPlayback.Stop; //Party Mode - if (Mode = 1) then + if (Mode = smPartyMode) then begin FadeTo(@ScreenSingModi); end @@ -2122,7 +2126,7 @@ end; procedure TScreenSong.OpenEditor; begin - if (Songs.SongList.Count > 0) and (not CatSongs.Song[Interaction].Main) AND (Mode = 0) then + if (Songs.SongList.Count > 0) and (not CatSongs.Song[Interaction].Main) AND (Mode = smNormal) then begin AudioPlayback.Stop; AudioPlayback.PlayStart; @@ -2135,7 +2139,7 @@ end; //Team No of Team (0-5) procedure TScreenSong.DoJoker (Team: Byte); begin - {if (Mode = 1) AND (PartySession.Teams.NumTeams >= Team + 1) AND (PartySession.Teams.Teaminfo[Team].Joker > 0) then + {if (Mode = smPartyMode) AND (PartySession.Teams.NumTeams >= Team + 1) AND (PartySession.Teams.Teaminfo[Team].Joker > 0) then begin //Joker spielen Dec(PartySession.Teams.Teaminfo[Team].Joker); -- cgit v1.2.3