aboutsummaryrefslogtreecommitdiffstats
path: root/cmake/src/screens/UScreenTop5.pas
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/src/screens/UScreenTop5.pas')
-rw-r--r--cmake/src/screens/UScreenTop5.pas114
1 files changed, 94 insertions, 20 deletions
diff --git a/cmake/src/screens/UScreenTop5.pas b/cmake/src/screens/UScreenTop5.pas
index 1013a9b5..705d1e35 100644
--- a/cmake/src/screens/UScreenTop5.pas
+++ b/cmake/src/screens/UScreenTop5.pas
@@ -47,18 +47,21 @@ type
public
TextLevel: integer;
TextArtistTitle: integer;
+ DifficultyShow: integer;
StaticNumber: array[1..5] of integer;
TextNumber: array[1..5] of integer;
TextName: array[1..5] of integer;
TextScore: array[1..5] of integer;
+ TextDate: array[1..5] of integer;
Fadeout: boolean;
constructor Create; override;
- function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override;
+ function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override;
function ParseMouse(MouseButton: integer; BtnDown: boolean; X, Y: integer): boolean; override;
- procedure onShow; override;
+ procedure OnShow; override;
+ procedure DrawScores(difficulty: integer);
function Draw: boolean; override;
end;
@@ -67,19 +70,19 @@ implementation
uses
UDataBase,
UGraphic,
+ UMain,
UIni,
- UNote;
+ UNote,
+ UUnicodeUtils;
-function TScreenTop5.ParseInput(PressedKey: cardinal;
- CharCode: WideChar;
- PressedDown: boolean): boolean;
+function TScreenTop5.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean;
begin
Result := true;
if PressedDown then
begin
// check normal keys
- case WideCharUpperCase(CharCode)[1] of
- 'Q':
+ case UCS4UpperCase(CharCode) of
+ Ord('Q'):
begin
Result := false;
Exit;
@@ -98,6 +101,34 @@ begin
Fadeout := true;
end;
end;
+ SDLK_RIGHT:
+ begin
+ inc(DifficultyShow);
+ if (DifficultyShow>2) then
+ DifficultyShow:=0;
+ DrawScores(DifficultyShow);
+ end;
+ SDLK_LEFT:
+ begin
+ dec(DifficultyShow);
+ if (DifficultyShow<0) then
+ DifficultyShow:=2;
+ DrawScores(DifficultyShow);
+ end;
+ SDLK_UP:
+ begin
+ inc(DifficultyShow);
+ if (DifficultyShow>2) then
+ DifficultyShow:=0;
+ DrawScores(DifficultyShow);
+ end;
+ SDLK_DOWN:
+ begin
+ dec(DifficultyShow);
+ if (DifficultyShow<0) then
+ DifficultyShow:=2;
+ DrawScores(DifficultyShow);
+ end;
SDLK_SYSREQ:
begin
Display.SaveScreenShot;
@@ -113,7 +144,7 @@ begin
Result := true;
if (MouseButton = SDL_BUTTON_LEFT) and BtnDown then
//left-click anywhere sends return
- ParseInput(SDLK_RETURN, #0, true);
+ ParseInput(SDLK_RETURN, 0, true);
end;
constructor TScreenTop5.Create;
@@ -133,18 +164,22 @@ begin
TextNumber[I+1] := AddText (Theme.Top5.TextNumber[I]);
TextName[I+1] := AddText (Theme.Top5.TextName[I]);
TextScore[I+1] := AddText (Theme.Top5.TextScore[I]);
+ TextDate[I+1] := AddText (Theme.Top5.TextDate[I]);
end;
end;
-procedure TScreenTop5.onShow;
+procedure TScreenTop5.OnShow;
var
I: integer;
PMax: integer;
+ sung: boolean; //score added? otherwise in wasn't sung!
begin
inherited;
+ sung := false;
Fadeout := false;
+ DifficultyShow := Ini.Difficulty;
//ReadScore(CurrentSong);
@@ -152,35 +187,74 @@ begin
if PMax = 4 then
PMax := 5;
for I := 0 to PMax do
- DataBase.AddScore(CurrentSong, Ini.Difficulty, Ini.Name[I], Round(Player[I].ScoreTotalInt));
+ begin
+ if (Round(Player[I].ScoreTotalInt) > 0) and (ScreenSing.SungToEnd) then
+ begin
+ DataBase.AddScore(CurrentSong, Ini.Difficulty, Ini.Name[I], Round(Player[I].ScoreTotalInt));
+ sung:=true;
+ end;
+ end;
- DataBase.WriteScore(CurrentSong);
+ if sung then
+ DataBase.WriteScore(CurrentSong);
DataBase.ReadScore(CurrentSong);
Text[TextArtistTitle].Text := CurrentSong.Artist + ' - ' + CurrentSong.Title;
for I := 1 to Length(CurrentSong.Score[Ini.Difficulty]) do
begin
- Static[StaticNumber[I]].Visible := true;
+ Statics[StaticNumber[I]].Visible := true;
Text[TextNumber[I]].Visible := true;
Text[TextName[I]].Visible := true;
Text[TextScore[I]].Visible := true;
+ Text[TextDate[I]].Visible := true;
Text[TextName[I]].Text := CurrentSong.Score[Ini.Difficulty, I-1].Name;
Text[TextScore[I]].Text := IntToStr(CurrentSong.Score[Ini.Difficulty, I-1].Score);
+ Text[TextDate[I]].Text := CurrentSong.Score[Ini.Difficulty, I-1].Date;
end;
for I := Length(CurrentSong.Score[Ini.Difficulty]) + 1 to 5 do
begin
- Static[StaticNumber[I]].Visible := false;
+ Statics[StaticNumber[I]].Visible := false;
Text[TextNumber[I]].Visible := false;
Text[TextName[I]].Visible := false;
Text[TextScore[I]].Visible := false;
+ Text[TextDate[I]].Visible := false;
end;
Text[TextLevel].Text := IDifficulty[Ini.Difficulty];
end;
+procedure TScreenTop5.DrawScores(difficulty: integer);
+var
+ I: integer;
+begin
+ for I := 1 to Length(CurrentSong.Score[difficulty]) do
+ begin
+ Statics[StaticNumber[I]].Visible := true;
+ Text[TextNumber[I]].Visible := true;
+ Text[TextName[I]].Visible := true;
+ Text[TextScore[I]].Visible := true;
+ Text[TextDate[I]].Visible := true;
+
+ Text[TextName[I]].Text := CurrentSong.Score[difficulty, I-1].Name;
+ Text[TextScore[I]].Text := IntToStr(CurrentSong.Score[difficulty, I-1].Score);
+ Text[TextDate[I]].Text := CurrentSong.Score[difficulty, I-1].Date;
+ end;
+
+ for I := Length(CurrentSong.Score[difficulty]) + 1 to 5 do
+ begin
+ Statics[StaticNumber[I]].Visible := false;
+ Text[TextNumber[I]].Visible := false;
+ Text[TextName[I]].Visible := false;
+ Text[TextScore[I]].Visible := false;
+ Text[TextDate[I]].Visible := false;
+ end;
+
+ Text[TextLevel].Text := IDifficulty[difficulty];
+end;
+
function TScreenTop5.Draw: boolean;
//var
{
@@ -208,18 +282,18 @@ begin
if ScreenAct = 1 then
begin
LoadColor(
- Static[StaticBoxLightest[Item]].Texture.ColR,
- Static[StaticBoxLightest[Item]].Texture.ColG,
- Static[StaticBoxLightest[Item]].Texture.ColB,
+ Statics[StaticBoxLightest[Item]].Texture.ColR,
+ Statics[StaticBoxLightest[Item]].Texture.ColG,
+ Statics[StaticBoxLightest[Item]].Texture.ColB,
'P1Dark');
end;
if ScreenAct = 2 then
begin
LoadColor(
- Static[StaticBoxLightest[Item]].Texture.ColR,
- Static[StaticBoxLightest[Item]].Texture.ColG,
- Static[StaticBoxLightest[Item]].Texture.ColB,
+ Statics[StaticBoxLightest[Item]].Texture.ColR,
+ Statics[StaticBoxLightest[Item]].Texture.ColG,
+ Statics[StaticBoxLightest[Item]].Texture.ColB,
'P4Dark');
end;
}