aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code/Screens
diff options
context:
space:
mode:
authorwhiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-03-29 12:40:11 +0000
committerwhiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-03-29 12:40:11 +0000
commit8d591b8344e0cb87e1a987961b3790fa26d323a6 (patch)
treeb18a29024b31aa4d04283b6692b116c539ba6bc1 /Game/Code/Screens
parent92f5f8a835d4a5e6d68bd64057bd5198bf5ca63d (diff)
downloadusdx-8d591b8344e0cb87e1a987961b3790fa26d323a6.tar.gz
usdx-8d591b8344e0cb87e1a987961b3790fa26d323a6.tar.xz
usdx-8d591b8344e0cb87e1a987961b3790fa26d323a6.zip
Fixed Some Bugs in JumpTo Screen:
Now plays correct music Space Bug is gone Added onSentenceChange Procedure to ScreenSing git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@48 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
-rw-r--r--Game/Code/Screens/UScreenSing.pas116
-rw-r--r--Game/Code/Screens/UScreenSong.pas58
-rw-r--r--Game/Code/Screens/UScreenSongJumpto.pas41
3 files changed, 123 insertions, 92 deletions
diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas
index 7b96e273..201b97fa 100644
--- a/Game/Code/Screens/UScreenSing.pas
+++ b/Game/Code/Screens/UScreenSing.pas
@@ -50,6 +50,8 @@ type
//OnSentenceEnd for LineBonus + Singbar
procedure onSentenceEnd(S: Cardinal);
+ //OnSentenceChange (for Golden Notes)
+ procedure onSentenceChange(S: Cardinal);
end;
implementation
@@ -1055,73 +1057,73 @@ A: Real;
B: integer; //Max Points for Notes
begin
-//Check for Empty Sentence
-if (Czesci[0].Czesc[S].TotalNotes<=0) then
- exit;
+ //Check for Empty Sentence
+ if (Czesci[0].Czesc[S].TotalNotes<=0) then
+ exit;
-//Set Max Note Points
-if (Ini.LineBonus > 0) then
- B := 9000
-else
- B := 10000;
+ //Set Max Note Points
+ if (Ini.LineBonus > 0) then
+ B := 9000
+ else
+ B := 10000;
-for I := 0 to High(Player) do begin
- A := Player[I].Score + Player[I].ScoreGolden - Player[I].ScoreLast + 2;
+ for I := 0 to High(Player) do begin
+ A := Player[I].Score + Player[I].ScoreGolden - Player[I].ScoreLast + 2;
- //SingBar Mod
- If ({(Ini.Oscilloscope = 2) and }(Czesci[0].Czesc[S].TotalNotes>0)) then
- begin
- Player[I].ScorePercentTarget := Player[I].ScorePercentTarget + floor(A / (B * Czesci[0].Czesc[S].TotalNotes / Czesci[0].Wartosc) * 40 - 26);
- if Player[I].ScorePercentTarget < 0 then Player[I].ScorePercentTarget := 0;
- if Player[I].ScorePercentTarget > 99 then Player[I].ScorePercentTarget := 99;
+ //SingBar Mod
+ If ({(Ini.Oscilloscope = 2) and }(Czesci[0].Czesc[S].TotalNotes>0)) then
+ begin
+ Player[I].ScorePercentTarget := Player[I].ScorePercentTarget + floor(A / (B * Czesci[0].Czesc[S].TotalNotes / Czesci[0].Wartosc) * 40 - 26);
+ if Player[I].ScorePercentTarget < 0 then Player[I].ScorePercentTarget := 0;
+ if Player[I].ScorePercentTarget > 99 then Player[I].ScorePercentTarget := 99;
//end Singbar Mod
- end;
+ end;
//PhrasenBonus - Line Bonus Mod
- If (Ini.LineBonus > 0) then
- begin
-
- //Generate Steps 0 to 8
- A := Floor(A / (B * Czesci[0].Czesc[S].TotalNotes / Czesci[0].Wartosc) * 8);
- if A >= 8 then
- Player[I].LineBonus_Text := Language.Translate('LINEBONUS_PERFECT')
- else if (A = 6) or (A = 7) then
- Player[I].LineBonus_Text := Language.Translate('LINEBONUS_BETTER')
- else if A = 5 then
- Player[I].LineBonus_Text := Language.Translate('LINEBONUS_GOOD')
- else if (A = 3) or (A = 4) then
- Player[I].LineBonus_Text := Language.Translate('LINEBONUS_NORMAL')
- else if A = 2 then
- Player[I].LineBonus_Text := Language.Translate('LINEBONUS_BAD')
- else
- Player[I].LineBonus_Text := Language.Translate('LINEBONUS_WORST');
-
- //PhrasenBonus give Points
- Player[I].ScoreLine := Player[I].ScoreLine + (1000 / (Length(Czesci[0].Czesc) - NumEmptySentences) * A / 8);
- Player[I].ScoreLineI := Round(Player[I].ScoreLine / 10) * 10;
- //Update Total Score
- Player[I].ScoreTotalI := Player[I].ScoreI + Player[I].ScoreGoldenI + Player[I].ScoreLineI;
-
- //Color
- Player[I].LineBonus_Color.B := 0;
- Player[I].LineBonus_Color.R := (8-A)/8;
- Player[I].LineBonus_Color.G := A/10;
-
- Player[I].LineBonus_PosX := Player[I].LineBonus_StartX;
- Player[I].LineBonus_PosY := Player[I].LineBonus_StartY;
- Player[I].LineBonus_Alpha := 0.92;
- Player[I].LineBonus_Visible := True;
+ If (Ini.LineBonus > 0) then
+ begin
+
+ //Generate Steps 0 to 8
+ A := Floor(A / (B * Czesci[0].Czesc[S].TotalNotes / Czesci[0].Wartosc) * 8);
+ if A >= 8 then
+ Player[I].LineBonus_Text := Language.Translate('LINEBONUS_PERFECT')
+ else if (A = 6) or (A = 7) then
+ Player[I].LineBonus_Text := Language.Translate('LINEBONUS_BETTER')
+ else if A = 5 then
+ Player[I].LineBonus_Text := Language.Translate('LINEBONUS_GOOD')
+ else if (A = 3) or (A = 4) then
+ Player[I].LineBonus_Text := Language.Translate('LINEBONUS_NORMAL')
+ else if A = 2 then
+ Player[I].LineBonus_Text := Language.Translate('LINEBONUS_BAD')
+ else
+ Player[I].LineBonus_Text := Language.Translate('LINEBONUS_WORST');
+
+ //PhrasenBonus give Points
+ Player[I].ScoreLine := Player[I].ScoreLine + (1000 / (Length(Czesci[0].Czesc) - NumEmptySentences) * A / 8);
+ Player[I].ScoreLineI := Round(Player[I].ScoreLine / 10) * 10;
+ //Update Total Score
+ Player[I].ScoreTotalI := Player[I].ScoreI + Player[I].ScoreGoldenI + Player[I].ScoreLineI;
+
+ //Color
+ Player[I].LineBonus_Color.B := 0;
+ Player[I].LineBonus_Color.R := (8-A)/8;
+ Player[I].LineBonus_Color.G := A/10;
+
+ Player[I].LineBonus_PosX := Player[I].LineBonus_StartX;
+ Player[I].LineBonus_PosY := Player[I].LineBonus_StartY;
+ Player[I].LineBonus_Alpha := 0.92;
+ Player[I].LineBonus_Visible := True;
- end;
+ end;
-//Refresh LastScore
-Player[I].ScoreLast := Player[I].Score + Player[I].ScoreGolden;
+ //Refresh LastScore
+ Player[I].ScoreLast := Player[I].Score + Player[I].ScoreGolden;
-end;
+ end;
//PhrasenBonus - Line Bonus Mod End// }
//GoldenStarsTwinkle Mod
@@ -1129,4 +1131,10 @@ end;
//GoldenStarsTwinkle Mod End
end;
+//Called on Sentence Change S= New Current Sentence
+procedure TScreenSing.onSentenceChange(S: Cardinal);
+begin
+ //Dummy
+end;
+
end.
diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas
index 69ec8639..9202717d 100644
--- a/Game/Code/Screens/UScreenSong.pas
+++ b/Game/Code/Screens/UScreenSong.pas
@@ -74,6 +74,7 @@ type
procedure HideCatTL;// Show Cat in Tob left
procedure Refresh; //Refresh Song Sorting
procedure DrawEqualizer;
+ procedure ChangeMusic;
//Party Mode
procedure SelectRandomSong;
procedure SetJoker;
@@ -269,11 +270,7 @@ begin
FixSelected;
//Play Music:
- Music.Close;
- if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin
- Music.MoveTo(Music.Length / 4);
- Music.Play;
- end;
+ ChangeMusic;
end else begin // clicked on song
if (Mode = 0) then //Normal Mode -> Start Song
@@ -342,11 +339,7 @@ begin
//Play Music:
Music.PlayChange;
- Music.Close;
- if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin
- Music.MoveTo(Music.Length / 4);
- Music.Play;
- end;
+ ChangeMusic;
end;
@@ -392,11 +385,7 @@ begin
//Play Music:
Music.PlayChange;
- Music.Close;
- if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin
- Music.MoveTo(Music.Length / 4);
- Music.Play;
- end;
+ ChangeMusic;
end;
@@ -412,11 +401,7 @@ begin
SelectNext;
// InteractNext;
// SongTarget := Interaction;
- Music.Close;
- if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin
- Music.MoveTo(Music.Length / 4);
- Music.Play;
- end;
+ ChangeMusic;
SetScroll4;
UpdateLCD;
Light.LightOne(1, 200);
@@ -428,11 +413,7 @@ begin
if (Length(Songs.Song) > 0)AND (Mode = 0) then begin
Music.PlayChange;
SelectPrev;
- Music.Close;
- if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin
- Music.MoveTo(Music.Length / 4);
- Music.Play;
- end;
+ ChangeMusic;
SetScroll4;
UpdateLCD;
Light.LightOne(0, 200);
@@ -514,11 +495,7 @@ begin
end;
Music.PlayChange;
- Music.Close;
- if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin
- Music.MoveTo(Music.Length / 4);
- Music.Play;
- end;
+ ChangeMusic;
SetScroll4;
UpdateLCD;
end;
@@ -1288,6 +1265,21 @@ begin
LCD.WriteText(2, Text[TextTitle].Text);
end;
+//Procedure Change current played Preview
+procedure TScreenSong.ChangeMusic;
+begin
+ if (NOT CatSongs.Song[Interaction].Main) AND(CatSongs.VisibleSongs > 0) then
+ begin
+ Music.Close;
+ if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin
+ Music.MoveTo(Music.Length / 4);
+ Music.Play;
+ end;
+ end
+ else
+ Music.Stop;
+end;
+
procedure TScreenSong.SkipTo(Target: integer); // 0.5.0
var
Skip: integer;
@@ -1447,11 +1439,7 @@ begin
//Choose Song
SkipTo(I2-I);
- Music.Close;
- if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin
- Music.MoveTo(Music.Length / 4);
- Music.Play;
- end;
+ ChangeMusic;
end;
procedure TScreenSong.SetJoker;
diff --git a/Game/Code/Screens/UScreenSongJumpto.pas b/Game/Code/Screens/UScreenSongJumpto.pas
index 449141c3..2bf0cb5b 100644
--- a/Game/Code/Screens/UScreenSongJumpto.pas
+++ b/Game/Code/Screens/UScreenSongJumpto.pas
@@ -11,10 +11,20 @@ type
Songsfound: String;
NoSongsfound: String;
CatText: String;
+
+ //For ChangeMusic
+ LastPlayed: Integer;
+ VisibleBool: Boolean;
public
- Visible: Boolean; //Whether the Menu should be Drawn
VisSongs: Integer;
+
constructor Create; override;
+
+ //Visible //Whether the Menu should be Drawn
+ //Whether the Menu should be Drawn
+ procedure SetVisible(Value: Boolean);
+ property Visible: Boolean read VisibleBool write SetVisible;
+
function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override;
procedure onShow; override;
function Draw: boolean; override;
@@ -159,12 +169,29 @@ begin
AddText(Theme.SongJumpto.Text[I]);
Interaction := 0;
+ LastPlayed := 0;
+end;
+
+procedure TScreenSongJumpto.SetVisible(Value: Boolean);
+begin
+//If change from unvisible to Visible then OnShow
+ if (VisibleBool = False) AND (Value = True) then
+ OnShow;
+
+ VisibleBool := Value;
end;
procedure TScreenSongJumpto.onShow;
begin
- Interaction := 0;
- SetTextFound(0);
+ //Reset Screen if no Old Search is Displayed
+ if (CatSongs.CatNumShow <> -2) then
+ begin
+ Interaction := 0;
+ SelectType := 0;
+
+ Button[0].Text[0].Text := '';
+ Text[0].Text := NoSongsFound;
+ end;
end;
function TScreenSongJumpto.Draw: boolean;
@@ -189,6 +216,14 @@ begin
ScreenSong.Interaction := 0;
ScreenSong.SelectNext;
ScreenSong.FixSelected;
+
+ //Play Correct Music
+ if (ScreenSong.Interaction <> LastPlayed) then
+ begin
+ LastPlayed := ScreenSong.Interaction;
+
+ ScreenSong.ChangeMusic;
+ end;
end;
end.