1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
|
unit UScreenTop;
interface
uses
UMenu, SDL, SysUtils, UDisplay, UMusic, USongs, UThemes, ULCD, ModiSDK;
type
THandler = record
changed: boolean;
change_time: real;
end;
TScreenTop = class(TMenu)
public
MP3VolumeHandler: THandler;
TextLevel: integer;
TextArtistTitle: integer;
DifficultyShow: integer; //TODO
TeamInfo : TTeamInfo; //for M2-MOD
StaticNumber: array[1..8] of integer;
TextNumber: array[1..8] of integer;
TextName: array[1..8] of integer;
TextScore: array[1..8] of integer;
TextDate: array[1..8] of integer;
Fadeout: boolean;
constructor Create; override;
function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override;
procedure onShow; override;
function Draw: boolean; override;
//procedure DrawScores(difficulty: integer); TODO
end;
const
ID='ID_029'; //for help system
implementation
uses UGraphic, UDataBase, UDraw, UMain, UIni, UPartyM2, UTime, DateUtils, UHelp, ULog;
function TScreenTop.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean;
begin
Result := true;
If (PressedDown) Then begin
case PressedKey of
//MP3-Volume Up
SDLK_PAGEUP:
begin
if (ScreenSong.MP3Volume<100) then
begin
ScreenSong.MP3Volume := ScreenSong.MP3Volume+5;
Music.SetMusicVolume(ScreenSong.MP3Volume);
end;
MP3VolumeHandler.changed := true;
MP3VolumeHandler.change_time := 0;
end;
//MP3-Volume Down
SDLK_PAGEDOWN:
begin
if (ScreenSong.MP3Volume>0) then
begin
ScreenSong.MP3Volume := ScreenSong.MP3Volume-5;
Music.SetMusicVolume(ScreenSong.MP3Volume);
end;
MP3VolumeHandler.changed := true;
MP3VolumeHandler.change_time := 0;
end;
SDLK_TAB:
begin
ScreenPopupHelp.ShowPopup();
end;
SDLK_Q:
begin
Result := false;
end;
SDLK_ESCAPE,
SDLK_BACKSPACE,
SDLK_RETURN:
begin
if (Ini.SavePlayback=1) then
Music.VoicesClose;
if (not Fadeout) then begin
if(ScreenSong.Mode = smNormal) or (ScreenSong.Mode = smMedley) then
FadeTo(@ScreenSong)
else
begin
ScreenSong.SongIndex := -1;
Music.FadeStop(Ini.PreviewFading);
FadeTo(@ScreenPartyNewRoundM2);
end;
Fadeout := true;
end;
end;
SDLK_SYSREQ:
begin
Display.PrintScreen;
end;
end;
end;
end;
constructor TScreenTop.Create;
var
I: integer;
begin
inherited Create;
LoadFromTheme(Theme.Top);
TextLevel := AddText(Theme.Top.TextLevel);
TextArtistTitle := AddText(Theme.Top.TextArtistTitle);
for I := 0 to 7 do
StaticNumber[I+1] := AddStatic(Theme.Top.StaticNumber[I]);
for I := 0 to 7 do
TextNumber[I+1] := AddText(Theme.Top.TextNumber[I]);
for I := 0 to 7 do
TextName[I+1] := AddText(Theme.Top.TextName[I]);
for I := 0 to 7 do
TextScore[I+1] := AddText(Theme.Top.TextScore[I]);
for I := 0 to 7 do
TextDate[I+1] := AddText(Theme.Top.TextDate[I]);
end;
procedure TScreenTop.onShow;
var
I: integer;
PMax: integer;
sung: boolean;
TimeStamp: integer;
begin
if not Help.SetHelpID(ID) then
Log.LogError('No Entry for Help-ID ' + ID + ' (ScreenTop)');
Fadeout := false;
sung:=false;
TimeStamp := DateTimeToUnix(Now());
PMax := PlayersPlay - 1;
for I := 0 to PMax do
begin
if(ScreenSong.Mode=smChallenge) then
TeamInfo.TeamInfo[I].Score:=Player[I].ScoreTotalI;
if (Player[I].ScoreTotalI>100) and ScreenSong.SungToEnd and (ScreenSong.Mode<>smMedley) and
(not ScreenSong.PartyMedley) then
begin
DataBase.AddScore(AktSong, Ini.Difficulty, Ini.Name[I], Player[I].ScoreTotalI, TimeStamp);
sung := true;
end;
end;
if ScreenSong.Mode=smChallenge then
begin
PartySessionM2.Teams:=TeamInfo;
PartySessionM2.EndRound;
end;
if sung then
DataBase.WriteScore(AktSong);
DataBase.ReadScore(AktSong, 8, Ini.SumPlayers);
Text[TextArtistTitle].Text := AktSong.Artist + ' - ' + AktSong.Title;
for I := 1 to Length(AktSong.Score[Ini.Difficulty]) do begin
Static[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 := AktSong.Score[Ini.Difficulty, I-1].Name;
Text[TextScore[I]].Text := IntToStr(AktSong.Score[Ini.Difficulty, I-1].Score);
Text[TextDate[I]].Text := AktSong.Score[Ini.Difficulty, I-1].Date;
end;
for I := Length(AktSong.Score[Ini.Difficulty])+1 to 8 do begin
Static[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];
MP3VolumeHandler.changed := false;
end;
function TScreenTop.Draw: boolean;
//var
{ Min: real;
Max: real;
Wsp: real;
Wsp2: real;
Pet: integer;}
{ Item: integer;
P: integer;
C: integer;}
begin
// Singstar - let it be...... with 6 statics
{ if PlayersPlay = 6 then begin
for Item := 4 to 6 do begin
if ScreenAct = 1 then P := Item-4;
if ScreenAct = 2 then P := Item-1;
FillPlayer(Item, P);
{ if ScreenAct = 1 then begin
LoadColor(
Static[StaticBoxLightest[Item]].Texture.ColR,
Static[StaticBoxLightest[Item]].Texture.ColG,
Static[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,
'P4Dark');
end;}
{ end;
end;}
inherited Draw;
if MP3VolumeHandler.changed and (MP3VolumeHandler.change_time+TimeSkip<3) then
begin
MP3VolumeHandler.change_time := MP3VolumeHandler.change_time + TimeSkip;
DrawVolumeBar(10, 530, 780, 12, ScreenSong.MP3Volume);
end else
MP3VolumeHandler.changed := false;
end;
end.
|