diff options
author | brunzelchen <brunzelchen@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2010-07-24 08:31:15 +0000 |
---|---|---|
committer | brunzelchen <brunzelchen@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2010-07-24 08:31:15 +0000 |
commit | dec577c0d954dfbbdcd03fc8b4159d8d5965e7c8 (patch) | |
tree | b48e03216d69659b10afae17cecc603946aa2269 | |
parent | ac12e8ff541b2d30f0b5dd070f83fc43d9b2116d (diff) | |
download | usdx-dec577c0d954dfbbdcd03fc8b4159d8d5965e7c8.tar.gz usdx-dec577c0d954dfbbdcd03fc8b4159d8d5965e7c8.tar.xz usdx-dec577c0d954dfbbdcd03fc8b4159d8d5965e7c8.zip |
- added session log
- some minor changes for medley mode
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/1.0.1 Challenge MOD@2606 b956fd51-792f-4845-bead-9b4dfca2ff2c
-rw-r--r-- | Game/Code/Classes/ULog.pas | 41 | ||||
-rw-r--r-- | Game/Code/Screens/UScreenEditSub.pas | 10 | ||||
-rw-r--r-- | Game/Code/Screens/UScreenScore.pas | 2 | ||||
-rw-r--r-- | Game/Code/Screens/UScreenSing.pas | 53 |
4 files changed, 82 insertions, 24 deletions
diff --git a/Game/Code/Classes/ULog.pas b/Game/Code/Classes/ULog.pas index 62414999..8be7a8ca 100644 --- a/Game/Code/Classes/ULog.pas +++ b/Game/Code/Classes/ULog.pas @@ -294,19 +294,44 @@ var Num: integer;
FileName: string;
I: integer;
+ Year, Month, Day: word;
+ Hour, Min, Sec, MSec: word;
+ timestamp: integer;
+ datestr: string;
+ timestr: string;
+
+ function Fill(w: word): string;
+ begin
+ Result := '';
+ if (w<10) then
+ Result := '0';
+
+ Result := Result + IntToStr(w);
+ end;
begin
+ timestamp := DateTimeToUnix(Now());
+ DecodeDate(UnixToDateTime(timestamp), Year, Month, Day);
+ DecodeTime(UnixToDateTime(timestamp), Hour, Min, Sec, MSec);
+
+ datestr := IntToStr(Year) + Fill(Month) + Fill(Day);
+ timestr := Fill(Hour) + Fill(Min) + Fill(Sec);
+
if not FileSessionO then
begin
FileSessionO := false;
NumSungSongs := 0;
+ FileName := SessionLogPath + 'Session_' + datestr + '-' + timestr + '.log';
- for Num := 1 to 99999 do
+ if FileExists(FileName) then
begin
- FileName := IntToStr(Num);
- while Length(FileName) < 5 do FileName := '0' + FileName;
- FileName := SessionLogPath + 'Session_' + FileName + '.log';
- if not FileExists(FileName) then break
+ for Num := 1 to 9999 do
+ begin
+ FileName := IntToStr(Num);
+ while Length(FileName) < 4 do FileName := '0' + FileName;
+ FileName := SessionLogPath + 'Session_' + datestr + '-' + timestr + '_' + FileName + '.log';
+ if not FileExists(FileName) then break
+ end;
end;
AssignFile(FileSession, FileName);
@@ -319,7 +344,8 @@ begin If (FileSessionO) then
begin
WriteLn(FileSession, 'Session Log');
- WriteLn(FileSession, 'Date: ' + DatetoStr(Now) + ' Time: ' + TimetoStr(Now));
+ WriteLn(FileSession, 'Date: ' + IntToStr(Year) + '-' + Fill(Month) + '-' + Fill(Day) +
+ ' Time: ' + Fill(Hour) + ':' + Fill(Min) + ':' + Fill(Sec));
Flush(FileSession);
end;
@@ -332,7 +358,8 @@ begin WriteLn(FileSession, '');
WriteLn(FileSession, '');
WriteLn(FileSession, '#----------------------------------------------------------------');
- WriteLn(FileSession, '# ' + IntToStr(NumSungSongs) + ') ' + 'Date: ' + DatetoStr(Now) + ' Time: ' + TimetoStr(Now));
+ WriteLn(FileSession, '# ' + IntToStr(NumSungSongs) + ') ' + 'Date: ' + IntToStr(Year) + '-' + Fill(Month) + '-' + Fill(Day) +
+ ' Time: ' + Fill(Hour) + ':' + Fill(Min) + ':' + Fill(Sec));
WriteLn(FileSession, '# Sing mode: ' + singmode);
WriteLn(FileSession, '#----------------------------------------------------------------');
WriteLn(FileSession, '# Song: ' + Artist + ' - ' + Title + ':');
diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas index e41aba86..38199ad9 100644 --- a/Game/Code/Screens/UScreenEditSub.pas +++ b/Game/Code/Screens/UScreenEditSub.pas @@ -2061,7 +2061,7 @@ end; procedure TScreenEditSub.MarkSrc;
begin
- CopySrc := Czesci[0].Akt;
+ CopySrc := Czesci[CP].Akt;
end;
procedure TScreenEditSub.PasteText;
@@ -2069,11 +2069,11 @@ var C: integer;
N: integer;
begin
- C := Czesci[0].Akt;
+ C := Czesci[CP].Akt;
- for N := 0 to Czesci[0].Czesc[CopySrc].HighNut do
- Czesci[0].Czesc[C].Nuta[N].Tekst := Czesci[0].Czesc[CopySrc].Nuta[N].Tekst;
- EditorLyric[0].AddCzesc(0, Czesci[0].Akt);
+ for N := 0 to Czesci[CP].Czesc[CopySrc].HighNut do
+ Czesci[CP].Czesc[C].Nuta[N].Tekst := Czesci[CP].Czesc[CopySrc].Nuta[N].Tekst;
+ EditorLyric[CP].AddCzesc(CP, Czesci[CP].Akt);
end;
procedure TScreenEditSub.CopySentence(Src, Dst: integer);
diff --git a/Game/Code/Screens/UScreenScore.pas b/Game/Code/Screens/UScreenScore.pas index 4101aef9..b8a7b61c 100644 --- a/Game/Code/Screens/UScreenScore.pas +++ b/Game/Code/Screens/UScreenScore.pas @@ -130,7 +130,7 @@ begin Music.VoicesClose;
FadeTo(@ScreenPartyNewRoundM2);
- end else if (ScreenSong.Mode <> smMedley) then
+ end else if (ScreenSong.Mode <> smMedley) and not AktSong.isDuet then
FadeTo(@ScreenTop)
else
begin
diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 94c5d162..2844cc46 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -845,8 +845,15 @@ begin PlaylistMedley.ApplausePlayed := false;
if (ScreenSong.Mode = smMedley) or ScreenSong.PartyMedley then
begin
- CatSongs.Selected := PlaylistMedley.Song[PlaylistMedley.CurrentMedleySong-1];
- Music.Open(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].Mp3);
+ if (length(PlaylistMedley.Song)>=PlaylistMedley.CurrentMedleySong) then
+ begin
+ CatSongs.Selected := PlaylistMedley.Song[PlaylistMedley.CurrentMedleySong-1];
+ Music.Open(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].Mp3);
+ end else
+ begin
+ SongError;
+ Exit;
+ end;
end else
begin
for I := 0 to PlayersPlay - 1 do
@@ -1079,6 +1086,7 @@ var Min: integer;
Sec: integer;
Tekst: string;
+ sung: boolean;
Flash: real;
S: integer;
T: integer;
@@ -1232,19 +1240,21 @@ begin if Sec < 10 then Text[TextTimeText].Text := Text[TextTimeText].Text + '0';
Text[TextTimeText].Text := Text[TextTimeText].Text + IntToStr(Sec);
- if not AktSong.isDuet then
+ sung := true;
+ for I := 0 to Length(Czesci) - 1 do
begin
- lastLine := Length(Czesci[0].Czesc)-1;
- lastWord := Length(Czesci[0].Czesc[lastLine].Nuta)-1;
+ lastLine := Length(Czesci[I].Czesc)-1;
+ lastWord := Length(Czesci[I].Czesc[lastLine].Nuta)-1;
if (lastLine>=0) and (lastWord>=0) then
begin
- if (Czas.AktBeat>(Czesci[0].Czesc[lastLine].Nuta[lastWord].Start+
- Czesci[0].Czesc[lastLine].Nuta[lastWord].Dlugosc)) then
- ScreenSong.SungToEnd := true;
+ if (Czas.AktBeatD<(Czesci[I].Czesc[lastLine].Nuta[lastWord].Start+
+ Czesci[I].Czesc[lastLine].Nuta[lastWord].Dlugosc)) then
+ sung := false;
end;
- end else
- ScreenSong.SungToEnd := false; //do not save duet stats TODO: how to save duet stats?
+ end;
+
+ ScreenSong.SungToEnd := sung;
// for medley-mode:
CurTime := Czas.Teraz;
@@ -1397,7 +1407,7 @@ begin end;
end else
begin
- if not FadeOut then
+ if not FadeOut and ((Screens=1) or (ScreenAct = 2)) then
begin
Finish;
if ScreenSong.Mode = smNormal then
@@ -1586,6 +1596,8 @@ var scores: array of string;
names: array of string;
singmode: string;
+ Min, Sec: integer;
+ CurTime: real;
begin
Music.CaptureStop;
@@ -1643,6 +1655,25 @@ begin begin
singmode := 'Normal';
end;
+
+ if not ScreenSong.SungToEnd then
+ begin
+ singmode := singmode + ', abort at: ';
+
+ if ScreenSong.Mode <> smMedley then
+ CurTime := Czas.Teraz
+ else
+ CurTime := Czas.Teraz - MedleyStart;
+
+ Min := Round(CurTime) div 60;
+ Sec := Round(CurTime) mod 60;
+
+ if Min < 10 then singmode := singmode + '0';
+ singmode := singmode + IntToStr(Min) + ':';
+ if Sec < 10 then singmode := singmode + '0';
+ singmode := singmode + IntToStr(Sec);
+ end;
+
Log.LogSession(names, scores, AktSong.Artist, AktSong.Title, singmode);
end;
|